Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Commit

Permalink
Merge MrLavender's URL encoding fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Sep 23, 2018
1 parent 8c61029 commit 3a02bab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vazkii/cmpdl/CMPDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,12 @@ public static String getLocationHeader(String location) throws IOException, URIS
if(redirectLocation.startsWith("/"))
uri = new URI(uri.getScheme(), uri.getHost(), redirectLocation, uri.getFragment());
else {
url = new URL(redirectLocation);
uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), URLDecoder.decode(url.getPath().replace("%20", "%2B").replace("+", "%2B"), "UTF-8"), url.getQuery(), url.getRef());
try {
uri = new URI(redirectLocation);
} catch (URISyntaxException e) {
url = new URL(redirectLocation);
uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
}
}
}

Expand Down

0 comments on commit 3a02bab

Please sign in to comment.