Просмотр исходного кода

$nick was being localized even if there was a nick, so it would end up being undefined. Localize to the less global value of nick if there is a less global value.

sbingner 23 лет назад
Родитель
Сommit
4d888b2484
1 измененных файлов с 2 добавлено и 3 удалено
  1. 2 3
      modules/Pisg/HTMLGenerator.pm

+ 2 - 3
modules/Pisg/HTMLGenerator.pm

@@ -1786,15 +1786,14 @@ sub _replace_links
 
     my $texturl = $self->_template_text("newwindow");
     my $textmail = $self->_template_text("mailto");
-
     my (@str) = split(/ /,$str);
 
     foreach (@str) {
         if (m/(http|https|ftp|telnet|news)(:\/\/[-a-zA-Z0-9_\/~:@]+\.[-a-zA-Z0-9.,_~=:&@%?#\/+]+)/o) {
-            my $nick = $1 . $2 unless ($nick);
+            my $nick = $nick || $1 . $2;
             $_ = "<a href=\"$1$2\" target=\"_blank\" title=\"$texturl $1$2\">" . $self->_split_long_text($nick) . '</a>';
         } elsif (m/(^|[^:])\b([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+\.[-a-zA-Z0-9._]+)/o) {
-            my $nick = $2 unless ($nick);
+            my $nick = $nick || $1 . $2;
             $_ = "$1<a href=\"mailto:$2\" title=\"$textmail $nick\">" . $self->_split_long_text($nick) . "<\/a>";
         } else {
             $_ = $self->_split_long_text($_);