diff --git a/lib/email_cook.rb b/lib/email_cook.rb index 0e8dad21ec7..56eca025fcf 100644 --- a/lib/email_cook.rb +++ b/lib/email_cook.rb @@ -3,7 +3,7 @@ class EmailCook def self.url_regexp - /^((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/ + /((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/ end def initialize(raw) diff --git a/spec/components/email_cook_spec.rb b/spec/components/email_cook_spec.rb index 3f46781e2da..15844764d19 100644 --- a/spec/components/email_cook_spec.rb +++ b/spec/components/email_cook_spec.rb @@ -30,4 +30,8 @@ LONG_COOKED it 'autolinks' do expect(EmailCook.new("https://www.eviltrout.com").cook).to eq("https://www.eviltrout.com
") end + + it 'autolinks without the beginning of a line' do + expect(EmailCook.new("my site: https://www.eviltrout.com").cook).to eq("my site: https://www.eviltrout.com
") + end end