From a0205be8b5dac2c0c55be35afb118aa1f6e696a1 Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Fri, 6 Jul 2018 11:44:07 -0700 Subject: [PATCH] fixes #3771 --- app/logical/sources/strategies/deviant_art.rb | 2 ++ test/unit/sources/deviantart_test.rb | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/logical/sources/strategies/deviant_art.rb b/app/logical/sources/strategies/deviant_art.rb index e23498543..9a1019f84 100644 --- a/app/logical/sources/strategies/deviant_art.rb +++ b/app/logical/sources/strategies/deviant_art.rb @@ -110,6 +110,8 @@ module Sources "http://fav.me/d#{$1}" elsif url =~ %r{\Ahttps?://(?:fc|th|pre|orig|img)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i "http://fav.me/d#{$1}" + elsif url =~ %r{\Ahttps?://www\.deviantart\.com/([^/]+)/art/} + url elsif url =~ %r{deviantart\.com/art/} url else diff --git a/test/unit/sources/deviantart_test.rb b/test/unit/sources/deviantart_test.rb index facb50834..f23059e44 100644 --- a/test/unit/sources/deviantart_test.rb +++ b/test/unit/sources/deviantart_test.rb @@ -7,6 +7,17 @@ module Sources skip "DeviantArt API keys not set" unless Danbooru.config.deviantart_client_id.present? end + context "A path-based artist url" do + setup do + @site = Sources::Site.new("https://www.deviantart.com/aeror404/art/Holiday-Elincia-424551484") + @site.get + end + + should "work" do + assert_equal(["http://origin-orig.deviantart.net/d533/f/2014/004/8/d/holiday_elincia_by_aeror404-d70rm0s.jpg"], @site.image_urls) + end + end + context "The source for a private DeviantArt image URL" do setup do @site = Sources::Site.new("https://pre00.deviantart.net/423b/th/pre/i/2017/281/e/0/mindflayer_girl01_by_nickbeja-dbpxdt8.png")