FIX: errors loading secure uploads when secure uploads is disabled (#13047)

This commit is contained in:
Neil Lalonde
2021-06-08 13:25:51 -04:00
committed by GitHub
parent 49c231c993
commit c2c647b990
2 changed files with 15 additions and 2 deletions

View File

@@ -170,6 +170,8 @@ describe UrlHelper do
Rails.configuration.action_controller.asset_host = "https://test.some-cdn.com/dev"
FileStore::S3Store.any_instance.stubs(:has_been_uploaded?).returns(true)
SiteSetting.secure_media = true
end
def cooked
@@ -184,6 +186,16 @@ describe UrlHelper do
"//test.localhost/secure-media-uploads/dev/original/3X/2/e/2e6f2ef81b6910ea592cd6d21ee897cd51cf72e4.jpeg"
)
end
context "and secure_media setting is disabled" do
before { SiteSetting.secure_media = false }
it "returns the local_cdn_url" do
expect(cooked).to eq(
"//s3bucket.s3.dualstack.us-west-1.amazonaws.com/dev/original/3X/2/e/2e6f2ef81b6910ea592cd6d21ee897cd51cf72e4.jpeg"
)
end
end
end
context "when the upload for the url is not secure" do