sources: fix sources sometimes choosing wrong strategy (fix #3968)
Fix sources choosing the wrong strategy when the referer belongs to a different site (for example, when uploading a twitter post with a pixiv referer). * Fix `match?` to only consider the main url, not the referer. * Change `match?` to match against a list of domains given by the `domains` method. * Change `match?` to an instance method.
This commit is contained in:
@@ -229,5 +229,14 @@ module Sources
|
||||
assert_equal(desc2, site.dtext_artist_commentary_desc)
|
||||
end
|
||||
end
|
||||
|
||||
context "A twitter post with a pixiv referer" do
|
||||
should "use the twitter strategy" do
|
||||
site = Sources::Strategies.find("https://twitter.com/Mityubi/status/849630665603665920", "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=56735489")
|
||||
|
||||
assert_equal(site.site_name, "Twitter")
|
||||
assert_equal("https://pbs.twimg.com/media/C8p-gPhVoAMZupS.png:orig", site.image_url)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user