Don't normalize URLs in toots (#6134)
* Don't normalize URLs in toots URL normalization is ill-defined and may cause certain links to break. * Change specs since we are not normalizing user-provided URLs
This commit is contained in:
parent
161c72d66d
commit
a8b51124ba
2 changed files with 12 additions and 12 deletions
|
@ -171,10 +171,10 @@ class Formatter
|
|||
end
|
||||
|
||||
def link_to_url(entity)
|
||||
normalized_url = Addressable::URI.parse(entity[:url]).normalize
|
||||
html_attrs = { target: '_blank', rel: 'nofollow noopener' }
|
||||
url = Addressable::URI.parse(entity[:url])
|
||||
html_attrs = { target: '_blank', rel: 'nofollow noopener' }
|
||||
|
||||
Twitter::Autolink.send(:link_to_text, entity, link_html(entity[:url]), normalized_url, html_attrs)
|
||||
Twitter::Autolink.send(:link_to_text, entity, link_html(entity[:url]), url, html_attrs)
|
||||
rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError
|
||||
encode(entity[:url])
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue