From 6db50b820d282e24bbda8330cab2357a4fb19056 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 18 Jul 2016 13:46:13 -0400 Subject: [PATCH] FIX: Email cooker should link links that don't begin a line --- lib/email_cook.rb | 2 +- spec/components/email_cook_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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