diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java index 1f2a3b27..f680d8c4 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java @@ -264,7 +264,9 @@ public abstract class AbstractRipper if (!path.endsWith(File.separator)) { path += File.separator; } - path += getAlbumTitle(this.url) + File.separator; + String title = getAlbumTitle(this.url); + title = Utils.filesystemSafe(title); + path += title + File.separator; this.workingDir = new File(path); if (!this.workingDir.exists()) { logger.info("[+] Creating directory: " + Utils.removeCWD(this.workingDir)); diff --git a/src/main/java/com/rarchives/ripme/utils/Utils.java b/src/main/java/com/rarchives/ripme/utils/Utils.java index c8fe6e7c..8d20837d 100644 --- a/src/main/java/com/rarchives/ripme/utils/Utils.java +++ b/src/main/java/com/rarchives/ripme/utils/Utils.java @@ -241,4 +241,10 @@ public class Utils { + "..." + path.substring(path.length() - SHORTENED_PATH_LENGTH); } + + public static String filesystemSafe(String text) { + return text.replaceAll("[^a-zA-Z0-9.-]", "_") + .replaceAll("__", "_") + .replaceAll("_+$", ""); + } } \ No newline at end of file