Skip to content

Commit

Permalink
cleaning up some potential bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
4pr0n committed Apr 25, 2014
1 parent 746dd3f commit 554026b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ public void rip() throws IOException {
}

public boolean canRip(URL url) {
if (!url.getHost().endsWith(DOMAIN)) {
return false;
}
return true;
return url.getHost().endsWith(DOMAIN);
}

}
6 changes: 5 additions & 1 deletion src/main/java/com/rarchives/ripme/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,13 @@ public static String shortenPath(File file) {
}

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

public static String bytesToHumanReadable(int bytes) {
Expand Down

0 comments on commit 554026b

Please sign in to comment.