FIX: returns false if the upload url is an invalid mailto link (#9877)

This commit is contained in:
Roman Rizzi 2020-05-26 10:32:48 -03:00 committed by GitHub
parent f47400475e
commit b61a291cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -81,7 +81,7 @@ module FileStore
begin begin
parsed_url = URI.parse(URI.encode(url)) parsed_url = URI.parse(URI.encode(url))
rescue URI::InvalidURIError rescue URI::InvalidURIError, URI::InvalidComponentError
return false return false
end end

View File

@ -259,5 +259,11 @@ RSpec.describe 'Multisite s3 uploads', type: :multisite do
url = "https://www.someotherhostname.com/test/original/2X/d/dd7964f5fd13e1103c5244ca30abe1936c0a4b88.png" url = "https://www.someotherhostname.com/test/original/2X/d/dd7964f5fd13e1103c5244ca30abe1936c0a4b88.png"
expect(store.has_been_uploaded?(url)).to eq(true) expect(store.has_been_uploaded?(url)).to eq(true)
end end
it "returns false if the URI is an invalid mailto link" do
link = 'mailto: roman;@test.com'
expect(store.has_been_uploaded?(link)).to eq(false)
end
end end
end end