don't try to parse deviant art urls that lack a deviation id in the url

This commit is contained in:
Albert Yi
2019-04-16 14:00:38 -07:00
parent 6f4ca75bb1
commit 8a16e089d2

View File

@@ -91,7 +91,7 @@ module Sources
# work isn't downloadable, or download size is same as regular size.
elsif api_deviation.present?
src = api_deviation.dig(:content, :src)
if deviation_id.to_i <= 790677560 && src =~ /^https:\/\/images-wixmp-/
if deviation_id && deviation_id.to_i <= 790677560 && src =~ /^https:\/\/images-wixmp-/
src = src.sub(%r!(/f/[a-f0-9-]+/[a-f0-9-]+)!, '/intermediary\1')
src = src.sub(%r!/v1/(fit|fill)/.*\z!i, "")
end