mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:34:50 +08:00
FIX: Skip absolutizing URLs when source URI is invalid
This commit is contained in:
@ -186,7 +186,11 @@ class TopicEmbed < ActiveRecord::Base
|
||||
# Convert any relative URLs to absolute. RSS is annoying for this.
|
||||
def self.absolutize_urls(url, contents)
|
||||
url = normalize_url(url)
|
||||
uri = URI(UrlHelper.escape_uri(url))
|
||||
begin
|
||||
uri = URI(UrlHelper.escape_uri(url))
|
||||
rescue URI::Error
|
||||
return contents
|
||||
end
|
||||
prefix = "#{uri.scheme}://#{uri.host}"
|
||||
prefix << ":#{uri.port}" if uri.port != 80 && uri.port != 443
|
||||
|
||||
|
Reference in New Issue
Block a user