Skip to content

Commit b3e3908

Browse files
authored
Merge pull request #900 from ymohdriz/branch_issue_openapi_898
Code roll-in for issue 898
2 parents 2929e43 + 166ec0d commit b3e3908

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public void process(URLConnection connection) {
9494
public static String cleanUrl(String url) {
9595
String result = null;
9696
try {
97-
result =url.replaceAll("\\{", "%7B").replaceAll("\\}", "%7D");
97+
result =url.replaceAll("\\{", "%7B").
98+
replaceAll("\\}", "%7D").
99+
replaceAll(" ", "%20");
98100
}catch (Exception t){
99101
t.printStackTrace();
100102
}

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/util/RemoteUrlTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public void setUp() throws Exception {
4343
public void testCleanUrl() {
4444
String cleaned = RemoteUrl.cleanUrl("http://foo/bar/com/{v2}/fun");
4545
assertEquals(cleaned, "http://foo/bar/com/%7Bv2%7D/fun");
46+
47+
cleaned = RemoteUrl.cleanUrl("http://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/export?DocumentFormat=Swagger&ApiName=Face API - V1.0");
48+
assertEquals(cleaned, "http://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/export?DocumentFormat=Swagger&ApiName=Face%20API%20-%20V1.0");
4649
}
4750

4851
@Test

0 commit comments

Comments
 (0)