From cfb0366aca54618368e4abebbc8c951dab04ab63 Mon Sep 17 00:00:00 2001 From: soloturn Date: Sun, 28 Mar 2021 08:03:29 +0200 Subject: [PATCH] abstractripper avoids endless runs by checking url is seen multiple bug reports were made, like #20, RipMeApp#1854 . --- .../com/rarchives/ripme/ripper/AbstractHTMLRipper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java index 3e3fdb189..db18b2e1a 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java @@ -6,10 +6,12 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.jsoup.nodes.Document; import com.rarchives.ripme.ui.RipStatusMessage.STATUS; @@ -104,7 +106,15 @@ public void rip() throws IOException { LOGGER.debug("Adding items from " + this.url + " to queue"); } + List doclocation = new ArrayList<>(); while (doc != null) { + + // catch if we saw a doc location already, save the ones seen in a list + if (doclocation.contains(doc.location())) { + break; + } + doclocation.add(doc.location()); + if (alreadyDownloadedUrls >= Utils.getConfigInteger("history.end_rip_after_already_seen", 1000000000) && !isThisATest()) { sendUpdate(STATUS.DOWNLOAD_COMPLETE_HISTORY, "Already seen the last " + alreadyDownloadedUrls + " images ending rip"); break;