FIX: handle encoded mailto links when looking for upload record

This commit is contained in:
Arpit Jalan 2018-05-17 12:43:30 +05:30
parent 117763493b
commit 539cf32f87
2 changed files with 2 additions and 1 deletions

View File

@ -84,7 +84,7 @@ class Upload < ActiveRecord::Base
# always try to get the path # always try to get the path
uri = begin uri = begin
URI(url) URI(URI.unescape(url))
rescue URI::InvalidURIError rescue URI::InvalidURIError
end end

View File

@ -87,6 +87,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
end end
describe "s3 store" do describe "s3 store" do