Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/com/rarchives/ripme/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,12 @@ public static String shortenPath(File file) {
* @return The sanitized text.
*/
public static String filesystemSanitized(String text) {
text = text.replaceAll("[^a-zA-Z0-9.-]", "_");
text = text.replaceAll("[^ !#-)+-.0-9;=@-\\[\\]-{}~]", "").trim().replaceAll("\\.+$", "");
return text;
}

public static String filesystemSafe(String text) {
text = text.replaceAll("[^a-zA-Z0-9.-]", "_").replaceAll("__", "_").replaceAll("_+$", "");
text = text.replaceAll("[^ !#-)+-.0-9;=@-\\[\\]-{}~]", "").trim().replaceAll("\\.+$", "");
if (text.length() > 100) {
text = text.substring(0, 99);
}
Expand Down Expand Up @@ -857,7 +857,7 @@ public static boolean fuzzyExists(File folder, String fileName) {
}

public static String sanitizeSaveAs(String fileNameToSan) {
return fileNameToSan.replaceAll("[\\\\/:*?\"<>|]", "_");
return fileNameToSan.replaceAll("[^ !#-)+-.0-9;=@-\\[\\]-{}~]", "").trim().replaceAll("\\.+$", "");
}

public static File shortenSaveAsWindows(String ripsDirPath, String fileName) throws FileNotFoundException {
Expand Down