Skip to content

Commit 6977025

Browse files
committed
abstractripper new uri instead url
1 parent edc5d9d commit 6977025

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.io.IOException;
99
import java.lang.reflect.Constructor;
1010
import java.net.MalformedURLException;
11+
import java.net.URI;
1112
import java.net.URISyntaxException;
1213
import java.net.URL;
1314
import java.nio.file.Files;
@@ -302,8 +303,8 @@ protected boolean addURLToDownload(URL url, String subdirectory, String referrer
302303
if (url.toExternalForm().contains(" ")) {
303304
// If for some reason the url with all spaces encoded as %20 is malformed print an error
304305
try {
305-
url = new URL(url.toExternalForm().replaceAll(" ", "%20"));
306-
} catch (MalformedURLException e) {
306+
url = new URI(url.toExternalForm().replaceAll(" ", "%20")).toURL();
307+
} catch (MalformedURLException | URISyntaxException e) {
307308
LOGGER.error("Unable to remove spaces from url\nURL: " + url.toExternalForm());
308309
e.printStackTrace();
309310
}

0 commit comments

Comments
 (0)