Skip to content

Commit 9bbfe7f

Browse files
committed
Merge pull request #32 from Walletron/master
URL path encoding
2 parents e85973f + 7e21b76 commit 9bbfe7f

File tree

1 file changed

+11
-1
lines changed
  • modules/swagger-parser/src/main/java/io/swagger/parser/util

1 file changed

+11
-1
lines changed

modules/swagger-parser/src/main/java/io/swagger/parser/util/RemoteUrl.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ public static String urlToString(String url, List<AuthorizationValue> auths) thr
7878
}
7979
}
8080
else {
81-
conn = new URL(url).openConnection();
81+
URL urltouse = new URL(url);
82+
//This step properly escapes the path of the URL
83+
URI uri = new URI(
84+
urltouse.getProtocol(),
85+
urltouse.getAuthority(),
86+
urltouse.getHost(),
87+
urltouse.getPort(),
88+
urltouse.getPath(),
89+
urltouse.getQuery(),
90+
null);
91+
conn = uri.toURL().openConnection();
8292
}
8393

8494
StringBuilder sb = new StringBuilder();

0 commit comments

Comments
 (0)