FIX: store the topic links using the cooked upload url

This commit is contained in:
Régis Hanol
2018-08-14 12:23:32 +02:00
parent ad5f502332
commit de92913bf4
31 changed files with 116 additions and 110 deletions

View File

@@ -218,7 +218,7 @@ module Email
begin
uri = URI.parse(base_url)
host = uri.host.downcase if uri.host.present?
rescue URI::InvalidURIError
rescue URI::Error
end
end
host

View File

@@ -153,7 +153,7 @@ module Email
# If an iframe is protocol relative, use SSL when displaying it
display_src = "#{src_uri.scheme || 'https'}://#{src_uri.host}#{src_uri.path}#{src_uri.query.nil? ? '' : '?' + src_uri.query}#{src_uri.fragment.nil? ? '' : '#' + src_uri.fragment}"
i.replace "<p><a href='#{src_uri.to_s}'>#{CGI.escapeHTML(display_src)}</a><p>"
rescue URI::InvalidURIError
rescue URI::Error
# If the URL is weird, remove the iframe
i.remove
end
@@ -215,7 +215,7 @@ module Email
@fragment.css("a").each do |link|
begin
link["href"] = "#{site_uri}#{link['href']}" unless URI(link["href"].to_s).host.present?
rescue URI::InvalidURIError, URI::InvalidComponentError
rescue URI::Error
# leave it
end
end