From 3d359be95866720bb9133dd62abd6d2935671d41 Mon Sep 17 00:00:00 2001 From: Wiiplay123 Date: Sun, 14 May 2017 20:15:27 -0500 Subject: [PATCH] Added precaution for URLs with slashes at the end when determining file name Made for my FurAffinity branch, brought it over to master branch because it could come in handy for other things. --- src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java index 99ce1fec..300e8a64 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java @@ -142,6 +142,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper { } public String fileNameFromURL(URL url) { String saveAs = url.toExternalForm(); + if (saveAs.substring(saveAs.length() - 1) == "/") { saveAs = saveAs.substring(0,saveAs.length() - 1) ;} saveAs = saveAs.substring(saveAs.lastIndexOf('/')+1); if (saveAs.indexOf('?') >= 0) { saveAs = saveAs.substring(0, saveAs.indexOf('?')); } if (saveAs.indexOf('#') >= 0) { saveAs = saveAs.substring(0, saveAs.indexOf('#')); }