]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/CGI.pm
Ditch \r and \n in status fields (closes: #545895)
[debbugs.git] / Debbugs / CGI.pm
index d305aed7e2724261fa1c3723846bc378e0351a02..53f0b5d27487de0018dacc1f7ec4aaa1015e2ec3 100644 (file)
@@ -196,7 +196,7 @@ width and height are passed.
 
 sub version_url{
      my %params = validate_with(params => \@_,
-                               spec   => {package => {type => SCALAR,
+                               spec   => {package => {type => SCALAR|ARRAYREF,
                                                      },
                                           found   => {type => ARRAYREF,
                                                       default => [],
@@ -536,8 +536,8 @@ the split links with commas and spaces.
 sub maybelink {
     my ($links,$regex,$join) = @_;
     if (not defined $regex and not defined $join) {
-        $links =~ s{((?:ftp|http|https)://[\S~-]+?/?)([\)\'\:\.\,]?(?:\s|\.<|$))}
-                   {q(<a href=").html_escape($1).q(">).html_escape($1).q(</a>).$2}geimo;
+        $links =~ s{(.*?)((?:(?:ftp|http|https)://[\S~-]+?/?)?)([\)\'\:\.\,]?(?:\s|\.<|$))}
+                   {html_escape($1).(length $2?q(<a href=").html_escape($2).q(">).html_escape($2).q(</a>):'').html_escape($3)}geimo;
         return $links;
     }
     $join = ' ' if not defined $join;