From 6840c9895d5fd4b8ede8238c84138686bc12ad60 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 1 Dec 2015 03:08:28 -0800 Subject: [PATCH] Try to reduce false positives in split link detection. #650 --- src/Linkification/Linkify.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 440d5eb5c..3f45db633 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -49,7 +49,12 @@ Linkify = while (saved = snapshot.snapshotItem i++) if saved.nodeName is 'BR' - if /^(https?:\/\/)?[a-z0-9\-\.]+$/i.test(word) and snapshot.snapshotItem(i)?.data?.match(/^(\.[a-z0-9\-]+)*\//i) # link deliberately split + if ( + # link deliberately split + (part1 = word.match /(https?:\/\/)?([a-z\d-]+\.)*[a-z\d-]+$/i) and + (part2 = snapshot.snapshotItem(i)?.data?.match /^(\.[a-z\d-]+)*\//i) and + (part1[0] + part2[0]).search(Linkify.regString) is 0 + ) continue else break