Fix #3994: Some deviantart images mistakenly choosing preview image.
This commit is contained in:
@@ -70,7 +70,7 @@ module Sources
|
|||||||
if api_deviation.blank?
|
if api_deviation.blank?
|
||||||
[url]
|
[url]
|
||||||
# work is downloadable
|
# work is downloadable
|
||||||
elsif api_deviation[:is_downloadable] && api_deviation[:download_filesize] != api_deviation.dig(:content, :filesize)
|
elsif api_deviation[:is_downloadable]
|
||||||
src = api_download[:src]
|
src = api_download[:src]
|
||||||
src.gsub!(%r!\Ahttps?://s3\.amazonaws\.com/!i, "https://")
|
src.gsub!(%r!\Ahttps?://s3\.amazonaws\.com/!i, "https://")
|
||||||
src.gsub!(/\?.*\z/, "") # strip s3 query params
|
src.gsub!(/\?.*\z/, "") # strip s3 query params
|
||||||
|
|||||||
@@ -43,6 +43,15 @@ module Sources
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "The source for a download-enabled DeviantArt artwork page" do
|
||||||
|
should "get the download image url" do
|
||||||
|
@site = Sources::Strategies.find("https://www.deviantart.com/len1/art/All-that-Glitters-II-774592781")
|
||||||
|
|
||||||
|
assert_equal(["http://origin-orig.deviantart.net/a713/f/2018/333/3/6/all_that_glitters_ii_by_len1-dct67m5.jpg"], @site.image_urls)
|
||||||
|
assert_equal(@site.image_url, @site.canonical_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "The source for a DeviantArt image url" do
|
context "The source for a DeviantArt image url" do
|
||||||
should "fetch the source data" do
|
should "fetch the source data" do
|
||||||
@site = Sources::Strategies.find("https://pre00.deviantart.net/b5e6/th/pre/f/2016/265/3/5/legend_of_galactic_heroes_by_hideyoshi-daihpha.jpg")
|
@site = Sources::Strategies.find("https://pre00.deviantart.net/b5e6/th/pre/f/2016/265/3/5/legend_of_galactic_heroes_by_hideyoshi-daihpha.jpg")
|
||||||
|
|||||||
Reference in New Issue
Block a user