cleaning up some potential bugs

This commit is contained in:
4pr0n 2014-04-25 09:42:54 -07:00
parent 746dd3fdc9
commit 554026bfbe
2 changed files with 6 additions and 5 deletions

View File

@ -104,10 +104,7 @@ public class ImagefapRipper extends AlbumRipper {
} }
public boolean canRip(URL url) { public boolean canRip(URL url) {
if (!url.getHost().endsWith(DOMAIN)) { return url.getHost().endsWith(DOMAIN);
return false;
}
return true;
} }
} }

View File

@ -245,9 +245,13 @@ public class Utils {
} }
public static String filesystemSafe(String text) { public static String filesystemSafe(String text) {
return text.replaceAll("[^a-zA-Z0-9.-]", "_") text = text.replaceAll("[^a-zA-Z0-9.-]", "_")
.replaceAll("__", "_") .replaceAll("__", "_")
.replaceAll("_+$", ""); .replaceAll("_+$", "");
if (text.length() > 255) {
text = text.substring(0, 254);
}
return text;
} }
public static String bytesToHumanReadable(int bytes) { public static String bytesToHumanReadable(int bytes) {