diff --git a/src/vazkii/cmpdl/CMPDL.java b/src/vazkii/cmpdl/CMPDL.java index 1925ea6..1811b13 100644 --- a/src/vazkii/cmpdl/CMPDL.java +++ b/src/vazkii/cmpdl/CMPDL.java @@ -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()); + } } }