artstation: fix fetch source data for image urls.

Fixes 'Fetch source data' when uploading an image url and the referer
url is available:

* https://danbooru.donmai.us/uploads/new?url=https://cdna.artstation.com/p/assets/images/images/006/029/978/large/amama-l-z.jpg&ref=https://www.artstation.com/artwork/4BWW2
This commit is contained in:
evazion
2017-06-06 22:05:35 -05:00
parent edd02c4019
commit 39bd141667
2 changed files with 16 additions and 3 deletions

View File

@@ -14,12 +14,12 @@ module Sources
[Strategies::PixivWhitecube, Strategies::Pixiv, Strategies::NicoSeiga, Strategies::DeviantArt, Strategies::ArtStation, Strategies::Nijie, Strategies::Twitter, Strategies::Tumblr, Strategies::Pawoo]
end
def initialize(url, options = {})
def initialize(url, referer_url: nil)
@url = url
Site.strategies.each do |strategy|
if strategy.url_match?(url)
@strategy = strategy.new(url, options[:referer_url])
if strategy.url_match?(url) || strategy.url_match?(referer_url)
@strategy = strategy.new(url, referer_url)
break
end
end