From 2301df20198aaed8564cde8e3c3218132ab74848 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 21 Jul 2024 20:05:17 -0700 Subject: [PATCH] Don't linkify trailing ; in bug messages (closes #1076323) --- debian/changelog | 2 ++ lib/Debbugs/CGI/Bugreport.pm | 2 +- t/07_bugreport.t | 22 +++++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a6392022..4d4d8848 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ debbugs (3.0.0~alpha.1) unstable; urgency=medium 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 Fri, 09 Mar 2018 11:17:10 -0800 diff --git a/lib/Debbugs/CGI/Bugreport.pm b/lib/Debbugs/CGI/Bugreport.pm index a6063944..6841b88b 100644 --- a/lib/Debbugs/CGI/Bugreport.pm +++ b/lib/Debbugs/CGI/Bugreport.pm @@ -283,7 +283,7 @@ sub display_entity { # 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 }{$1$2}gox; # Add links to bug closures $body =~ s[((?:closes|see):\s* # start of closed/referenced bugs diff --git a/t/07_bugreport.t b/t/07_bugreport.t index 22efa238..02ded8a3 100644 --- a/t/07_bugreport.t +++ b/t/07_bugreport.t @@ -1,7 +1,7 @@ # -*- mode: cperl;-*- -use Test::More tests => 19; +use Test::More tests => 22; use warnings; use strict; @@ -150,4 +150,24 @@ EOF } # 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 => <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 ;'); -- 2.39.5