Escape URLs, for usernames with spaces (#100)

This commit is contained in:
Evan Goode authored and GitHub committed 2020-07-01 22:47:47 +08:00
1 parent d7f207177c
commit 46bccadca2
1 file changed
+11 -1
@@ -115,7 +115,17 @@ public class HttpRequestUtil {
}
//Init Connection
String url = new URI(request.url).toASCIIString();
URL rawUrl = new URL(request.url);
URI uri = new URI(
rawUrl.getProtocol(),
rawUrl.getUserInfo(),
rawUrl.getHost(),
rawUrl.getPort(),
rawUrl.getPath(),
rawUrl.getQuery(),
rawUrl.getRef()
);
String url = uri.toASCIIString();
if (!url.equalsIgnoreCase(request.url))
CustomSkinLoader.logger.debug("Encoded URL: " + url);
HttpURLConnection c = (HttpURLConnection) (new URL(url)).openConnection();