From 311f457430e4863f3c74fe6e222a96f62fc0148d Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Tue, 13 Oct 2020 12:47:38 +0200 Subject: Fix crash when autolinking an invalid URI in Markdown --- app/lib/formatter.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/lib') 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 -- cgit