about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-01-03 20:51:33 +0100
committerEugen Rochko <eugen@zeonfederated.com>2018-01-03 20:51:33 +0100
commita8b51124ba822703cb7bd70cea9ec46e4d0ee287 (patch)
tree723c83e1516e76dfb73951da4b3db954d0a215ae /app
parent161c72d66d25bb8f5ff492e36a8521c701ab8afc (diff)
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
Diffstat (limited to 'app')
-rw-r--r--app/lib/formatter.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index f5bf64cc7..8c0f8cebc 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -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