From c4b18c94e7f8413abdc5b760c9bbbd9ae5226f13 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 2 Apr 2020 15:39:16 +0200 Subject: [PATCH] e621: allow old urls for pools --- src/be/nikiroo/fanfix/supported/E621.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/be/nikiroo/fanfix/supported/E621.java b/src/be/nikiroo/fanfix/supported/E621.java index 316ac2c..4b2fb90 100644 --- a/src/be/nikiroo/fanfix/supported/E621.java +++ b/src/be/nikiroo/fanfix/supported/E621.java @@ -3,6 +3,7 @@ package be.nikiroo.fanfix.supported; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; import java.util.AbstractMap; @@ -170,6 +171,13 @@ class E621 extends BasicSupport { } } + if (isPool(source)) { + try { + return new URL(source.toString().replace("/pool/show/", "/pools/")); + } catch (MalformedURLException e) { + } + } + return super.getCanonicalUrl(source); } @@ -287,7 +295,7 @@ class E621 extends BasicSupport { } private boolean isPool(URL url) { - return url.getPath().startsWith("/pools/"); + return url.getPath().startsWith("/pools/") || url.getPath().startsWith("/pool/show/"); } // set will be renamed into search by canonical url -- 2.27.0