]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: update linkification regexp to be more domain sensitive
authorEric Wong <e@80x24.org>
Sun, 30 Aug 2015 00:12:31 +0000 (00:12 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 Aug 2015 00:12:31 +0000 (00:12 +0000)
This avoids capturing links such as "http://#{foo}" => "http://#"
inside diffs

lib/PublicInbox/View.pm

index 08d78945a49e65a882143b2c5086afd97633aaa6..bd0a27aa6b454db0c296d03b2e0793b473c7bbd2 100644 (file)
@@ -244,7 +244,9 @@ sub add_filename_line {
        "$pad " . ascii_html($fn) . " $pad\n";
 }
 
-my $LINK_RE = qr!\b((?:ftp|https?|nntp)://[@\w\+\&\?\.\%\;/#=-]+)!;
+my $LINK_RE = qr!\b((?:ftp|https?|nntp)://
+                [\@:\w\.-]+/
+                ?[\@\w\+\&\?\.\%\;/#=-]*)!x;
 
 sub linkify {
        # no newlines added here since it'd break the splitting we do