mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: handle invalid mailto links
This commit is contained in:
parent
9d4d6276b7
commit
290ee312e6
@ -85,7 +85,7 @@ class Upload < ActiveRecord::Base
|
|||||||
# always try to get the path
|
# always try to get the path
|
||||||
uri = begin
|
uri = begin
|
||||||
URI(URI.unescape(url))
|
URI(URI.unescape(url))
|
||||||
rescue URI::InvalidURIError
|
rescue URI::InvalidURIError, URI::InvalidComponentError
|
||||||
end
|
end
|
||||||
|
|
||||||
url = uri.path if uri.try(:scheme)
|
url = uri.path if uri.try(:scheme)
|
||||||
|
@ -88,6 +88,7 @@ describe Upload do
|
|||||||
it "doesn't blow up with an invalid URI" do
|
it "doesn't blow up with an invalid URI" do
|
||||||
expect { Upload.get_from_url("http://ip:port/index.html") }.not_to raise_error
|
expect { Upload.get_from_url("http://ip:port/index.html") }.not_to raise_error
|
||||||
expect { Upload.get_from_url("mailto:admin%40example.com") }.not_to raise_error
|
expect { Upload.get_from_url("mailto:admin%40example.com") }.not_to raise_error
|
||||||
|
expect { Upload.get_from_url("mailto:example") }.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "s3 store" do
|
describe "s3 store" do
|
||||||
|
Loading…
Reference in New Issue
Block a user