FIX: Don't blow up when trying to parse invalid or non-ASCII URLs (#9838)

* FIX: Don't blow up when trying to parseinvalid or non-ASCII URLs

Follow-up to 72f139191e
This commit is contained in:
Osama Sayegh
2020-05-20 12:46:27 +03:00
committed by GitHub
parent fb15da43da
commit 02f44def56
2 changed files with 15 additions and 1 deletions

View File

@@ -79,7 +79,12 @@ module FileStore
def has_been_uploaded?(url)
return false if url.blank?
parsed_url = URI.parse(url)
begin
parsed_url = URI.parse(URI.encode(url))
rescue URI::InvalidURIError
return false
end
base_hostname = URI.parse(absolute_base_url).hostname
if url[base_hostname]
# if the hostnames match it means the upload is in the same