mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:34:50 +08:00
Normalize URL from Feed Entry after adding link to original in Topic
Since a URL might be case sensitive, adding a link to the original Feed Entry with changed case to the Topic could end in 404.
This commit is contained in:
@ -14,13 +14,13 @@ class TopicEmbed < ActiveRecord::Base
|
||||
def self.import(user, url, title, contents)
|
||||
return unless url =~ /^https?\:\/\//
|
||||
|
||||
url = normalize_url(url)
|
||||
|
||||
if SiteSetting.embed_truncate
|
||||
contents = first_paragraph_from(contents)
|
||||
end
|
||||
contents << "\n<hr>\n<small>#{I18n.t('embed.imported_from', link: "<a href='#{url}'>#{url}</a>")}</small>\n"
|
||||
|
||||
url = normalize_url(url)
|
||||
|
||||
embed = TopicEmbed.where("lower(embed_url) = ?", url).first
|
||||
content_sha1 = Digest::SHA1.hexdigest(contents)
|
||||
post = nil
|
||||
|
Reference in New Issue
Block a user