mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:40:00 +08:00
FIX: returns false if the upload url is an invalid mailto link (#9877)
This commit is contained in:
parent
f47400475e
commit
b61a291cf3
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user