From: Byron Jones Date: Tue, 11 Feb 2014 05:03:15 +0000 (+0800) Subject: Bug 970184: "possible duplicates" shouldn't truncate words at the first non-word... X-Git-Tag: bugzilla-4.5.3~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccbeca7150a295e3a5b3fade2f2b07247dcb4d16;p=thirdparty%2Fbugzilla.git Bug 970184: "possible duplicates" shouldn't truncate words at the first non-word character r=dkl, a=glob --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index a2a8827a51..a96731949c 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -522,8 +522,10 @@ sub possible_duplicates { my $dbh = Bugzilla->dbh; my $user = Bugzilla->user; my @words = split(/[\b\s]+/, $short_desc || ''); - # Exclude punctuation from the array. - @words = map { /(\w+)/; $1 } @words; + # Remove leading/trailing punctuation from words + foreach my $word (@words) { + $word =~ s/(?:^\W+|\W+$)//g; + } # And make sure that each word is longer than 2 characters. @words = grep { defined $_ and length($_) > 2 } @words;