1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-12 00:44:03 +02:00

abstractripper new uri instead url

This commit is contained in:
soloturn
2024-04-06 14:55:36 +02:00
parent edc5d9d568
commit 6977025e0f

View File

@@ -8,6 +8,7 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.file.Files; import java.nio.file.Files;
@@ -302,8 +303,8 @@ public abstract class AbstractRipper
if (url.toExternalForm().contains(" ")) { if (url.toExternalForm().contains(" ")) {
// If for some reason the url with all spaces encoded as %20 is malformed print an error // If for some reason the url with all spaces encoded as %20 is malformed print an error
try { try {
url = new URL(url.toExternalForm().replaceAll(" ", "%20")); url = new URI(url.toExternalForm().replaceAll(" ", "%20")).toURL();
} catch (MalformedURLException e) { } catch (MalformedURLException | URISyntaxException e) {
LOGGER.error("Unable to remove spaces from url\nURL: " + url.toExternalForm()); LOGGER.error("Unable to remove spaces from url\nURL: " + url.toExternalForm());
e.printStackTrace(); e.printStackTrace();
} }