From 34aa22f90bb4fc24b9ede2133c1ec69841c47b14 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 23 Mar 2022 22:21:13 -0500 Subject: [PATCH] sources: fix fandom.com page urls. Fix it so that sources like this: * https://vignette.wikia.nocookie.net/valkyriecrusade/images/c/c5/Crimson_Hatsune_H.png/revision/latest?cb=20180702031954 link to this: * https://valkyriecrusade.fandom.com/?file=Crimson_Hatsune_H.png instead of this * https://valkyriecrusade.fandom.com/wiki/File:Crimson_Hatsune_H.png The `/wiki/File:$name` URL redirects to whatever wiki page contains the image instead of showing the file itself. --- app/logical/source/url/null.rb | 2 +- test/unit/sources/null_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/logical/source/url/null.rb b/app/logical/source/url/null.rb index 911ca4d61..516ec62d2 100644 --- a/app/logical/source/url/null.rb +++ b/app/logical/source/url/null.rb @@ -181,7 +181,7 @@ class Source::URL::Null < Source::URL in _, "nocookie.net", wiki, "images", /^\h$/, /^\h\h$/, file, *rest @wiki = wiki @file = file - @page_url = "https://#{wiki}.fandom.com/wiki/File:#{file}" + @page_url = "https://#{wiki}.fandom.com/?file=#{file}" # https://static.zerochan.net/Fullmetal.Alchemist.full.2831797.png # https://s1.zerochan.net/Cocoa.Cookie.600.2957938.jpg diff --git a/test/unit/sources/null_test.rb b/test/unit/sources/null_test.rb index 3525bcb6c..af521fc77 100644 --- a/test/unit/sources/null_test.rb +++ b/test/unit/sources/null_test.rb @@ -84,7 +84,7 @@ module Sources should "normalize wikia links" do source = "https://vignette.wikia.nocookie.net/valkyriecrusade/images/c/c5/Crimson_Hatsune_H.png/revision/latest?cb=20180702031954" - assert_equal("https://valkyriecrusade.fandom.com/wiki/File:Crimson_Hatsune_H.png", Source::URL.page_url(source)) + assert_equal("https://valkyriecrusade.fandom.com/?file=Crimson_Hatsune_H.png", Source::URL.page_url(source)) end should "normalize e-shuushuu links" do