fixes #3293
This commit is contained in:
@@ -114,7 +114,7 @@ module Downloads
|
|||||||
end # def
|
end # def
|
||||||
|
|
||||||
def fix_twitter_sources(src)
|
def fix_twitter_sources(src)
|
||||||
if src =~ %r!^https?://pbs\.twimg\.com/! && original_source =~ %r!^https?://twitter\.com/!
|
if src =~ %r!^https?://(?:video|pbs)\.twimg\.com/! && original_source =~ %r!^https?://twitter\.com/!
|
||||||
original_source
|
original_source
|
||||||
elsif src =~ %r!^https?://img\.pawoo\.net/! && original_source =~ %r!^https?://pawoo\.net/!
|
elsif src =~ %r!^https?://img\.pawoo\.net/! && original_source =~ %r!^https?://pawoo\.net/!
|
||||||
original_source
|
original_source
|
||||||
|
|||||||
@@ -2,6 +2,23 @@ require 'test_helper'
|
|||||||
|
|
||||||
module Downloads
|
module Downloads
|
||||||
class FileTest < ActiveSupport::TestCase
|
class FileTest < ActiveSupport::TestCase
|
||||||
|
context "A twitter video download" do
|
||||||
|
setup do
|
||||||
|
@source = "https://twitter.com/CincinnatiZoo/status/859073537713328129"
|
||||||
|
@tempfile = Tempfile.new("danbooru-test")
|
||||||
|
@download = Downloads::File.new(@source, @tempfile.path)
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
@tempfile.close
|
||||||
|
end
|
||||||
|
|
||||||
|
should "preserve the twitter source" do
|
||||||
|
@download.download!
|
||||||
|
assert_equal("https://twitter.com/CincinnatiZoo/status/859073537713328129", @download.source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "A post download" do
|
context "A post download" do
|
||||||
setup do
|
setup do
|
||||||
@source = "http://www.google.com/intl/en_ALL/images/logo.gif"
|
@source = "http://www.google.com/intl/en_ALL/images/logo.gif"
|
||||||
|
|||||||
Reference in New Issue
Block a user