mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: lightbox wasn't working when using s3 upload
This commit is contained in:
@@ -164,15 +164,15 @@ describe CookedPostProcessor do
|
||||
end
|
||||
end
|
||||
|
||||
context 'get_image_uri' do
|
||||
context 'is_valid_image_uri?' do
|
||||
|
||||
it "returns nil unless the scheme is either http or https" do
|
||||
cpp.get_image_uri("http://domain.com").should == URI.parse("http://domain.com")
|
||||
cpp.get_image_uri("https://domain.com").should == URI.parse("https://domain.com")
|
||||
cpp.get_image_uri("ftp://domain.com").should == nil
|
||||
cpp.get_image_uri("ftps://domain.com").should == nil
|
||||
cpp.get_image_uri("//domain.com").should == nil
|
||||
cpp.get_image_uri("/tmp/image.png").should == nil
|
||||
it "needs the scheme to be either http or https" do
|
||||
cpp.is_valid_image_uri?("http://domain.com").should == true
|
||||
cpp.is_valid_image_uri?("https://domain.com").should == true
|
||||
cpp.is_valid_image_uri?("ftp://domain.com").should == false
|
||||
cpp.is_valid_image_uri?("ftps://domain.com").should == false
|
||||
cpp.is_valid_image_uri?("//domain.com").should == false
|
||||
cpp.is_valid_image_uri?("/tmp/image.png").should == false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -71,8 +71,15 @@ describe Upload do
|
||||
Upload.has_been_uploaded?("http://my.cdn.com/upload/1234/42/0123456789ABCDEF.jpg").should == true
|
||||
end
|
||||
|
||||
it "identifies S3 uploads" do
|
||||
SiteSetting.stubs(:enable_s3_uploads).returns(true)
|
||||
SiteSetting.stubs(:s3_upload_bucket).returns("bucket")
|
||||
Upload.has_been_uploaded?("//bucket.s3.amazonaws.com/1337.png").should == true
|
||||
end
|
||||
|
||||
it "identifies external urls" do
|
||||
Upload.has_been_uploaded?("http://domain.com/upload/1234/42/0123456789ABCDEF.jpg").should == false
|
||||
Upload.has_been_uploaded?("//bucket.s3.amazonaws.com/1337.png").should == false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user