summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2014-01-29 09:04:39 +0100
committerByron Jones <bjones@mozilla.com>2014-01-29 09:04:39 +0100
commitdb23eb216ba3476ef502285a5f2d50134177ec91 (patch)
treec7f6552ea402fdfe2cc3c4e661f87cf846742cf2 /Bugzilla/Template.pm
parentd5f827e9048b04d271a8aa0a1d638e934df61add (diff)
downloadbugzilla-db23eb216ba3476ef502285a5f2d50134177ec91.tar.gz
bugzilla-db23eb216ba3476ef502285a5f2d50134177ec91.tar.xz
Bug 105865: bugzilla should pay attention to linebreaks when making bugnumbers to links
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 81202965c..bf1254626 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -170,6 +170,10 @@ sub quoteUrls {
my $chr1 = chr(1);
$text =~ s/\0/$chr1\0/g;
+ # If the comment is already wrapped, we should ignore newlines when
+ # looking for matching regexps. Else we should take them into account.
+ my $s = ($comment && $comment->already_wrapped) ? qr/\s/ : qr/\h/;
+
# However, note that adding the title (for buglinks) can affect things
# In particular, attachment matches go before bug titles, so that titles
# with 'attachment 1' don't double match.
@@ -236,8 +240,8 @@ sub quoteUrls {
~<a href=\"mailto:$2\">$1$2</a>~igx;
# attachment links
- # BMO: Bug 652332 dkl@mozilla.com 2011-07-20
- $text =~ s~\b(attachment\s*\#?\s*(\d+)(?:\s+\[diff\])?(?:\s+\[details\])?)
+ # BMO: don't make diff view the default for patches (Bug 652332)
+ $text =~ s~\b(attachment$s*\#?$s*(\d+)(?:$s+\[diff\])?(?:\s+\[details\])?)
~($things[$count++] = get_attachment_link($2, $1, $user)) &&
("\0\0" . ($count-1) . "\0\0")
~egmxi;
@@ -250,14 +254,14 @@ sub quoteUrls {
# Also, we can't use $bug_re?$comment_re? because that will match the
# empty string
my $bug_word = template_var('terms')->{bug};
- my $bug_re = qr/\Q$bug_word\E\s*\#?\s*(\d+)/i;
- my $comment_re = qr/comment\s*\#?\s*(\d+)/i;
- $text =~ s~\b($bug_re(?:\s*,?\s*$comment_re)?|$comment_re)
+ my $bug_re = qr/\Q$bug_word\E$s*\#?$s*(\d+)/i;
+ my $comment_re = qr/comment$s*\#?$s*(\d+)/i;
+ $text =~ s~\b($bug_re(?:$s*,?$s*$comment_re)?|$comment_re)
~ # We have several choices. $1 here is the link, and $2-4 are set
# depending on which part matched
(defined($2) ? get_bug_link($2, $1, { comment_num => $3, user => $user }) :
"<a href=\"$current_bugurl#c$4\">$1</a>")
- ~egox;
+ ~egx;
# Old duplicate markers. These don't use $bug_word because they are old
# and were never customizable.