0
0
Fork 0

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:
ThibG 2018-01-03 20:51:33 +01:00 committed by Eugen Rochko
parent 161c72d66d
commit a8b51124ba
2 changed files with 12 additions and 12 deletions

View file

@ -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