# We don't html escape here because we escape above;
# wierd terminators are because of that
$body =~ s{((?:ftp|http|https|svn|ftps|rsync)://[\S~-]+?/?) # Url
- ((?:\>\;)?[)]?(?:'|\&\#39\;|\"\;)?[:.\,]?(?:\s|$)) # terminators
+ ((?:\>\;)?[)]?(?:'|\&\#39\;|\"\;)?[:.\,;]?(?:\s|$)) # terminators
}{<a href=\"$1\">$1</a>$2}gox;
# Add links to bug closures
$body =~ s[((?:closes|see):\s* # start of closed/referenced bugs
of mbox (closes: #1009181)
* Fix missing escaping of comma in address fields (closes: #1041638)
* Sort blocked-by (closes: 751808), thanks to Tim Landscheidt.
+ * Don't linkify trailing ; in bug messages (closes: #1076323), thanks to
+ Blair Noctis.
-- Don Armstrong <don@debian.org> Fri, 09 Mar 2018 11:17:10 -0800
# -*- mode: cperl;-*-
-use Test::More tests => 19;
+use Test::More tests => 22;
use warnings;
use strict;
}
# Other tests for bugs in the page should be added here eventually
+send_message(to => '1@bugs.something',
+ headers => [To => '1@bugs.something',
+ From => 'foo@bugs.something',
+ Subject => "Message with some links to linkify",
+ ],
+ body => <<EOF) or fail 'message to 1@bugs.something failed';
+This is a test message.
+
+This is a link https://example.com/foo; which should not include the ;
+
+
+This is a link https://example.com/foo;bar which should include the ;
+EOF
+
+$mech->get_ok('http://localhost:'.$port.'/?bug=1',
+ 'Page received ok');
+like($mech->content(), qr(href="https://example.com/foo;bar"),
+ 'Link includes ; correctly');
+like($mech->content(), qr(href="https://example.com/foo"),
+ 'Link excludes trailing ;');