mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user