about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-10-13 12:47:38 +0200
committerThibG <thib@sitedethib.com>2020-10-13 14:35:07 +0200
commit311f457430e4863f3c74fe6e222a96f62fc0148d (patch)
tree587ad3d1ce347a3bfe4a68e83c60e23188df8325 /app
parentcd861c051ce5500df49d2fc41b2a6084faa34620 (diff)
Fix crash when autolinking an invalid URI in Markdown
Diffstat (limited to 'app')
-rw-r--r--app/lib/formatter.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index c0f7866bf..e7bb0743d 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -11,6 +11,8 @@ class HTMLRenderer < Redcarpet::Render::HTML
   def autolink(link, link_type)
     return link if link_type == :email
     Formatter.instance.link_url(link)
+  rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError
+    encode(link)
   end
 
   private