about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-04 08:03:16 +0000
committerEric Wong <e@yhbt.net>2020-04-04 23:34:27 +0000
commitf9b63d4cd4d5a58c37ed8464b2d335a6932cc118 (patch)
tree7dfc025161a8e9401fbcbe764fa05c783a57d104
parent321fcd4881bc196521466c6698f7c4b4a4bb5360 (diff)
downloadpublic-inbox-f9b63d4cd4d5a58c37ed8464b2d335a6932cc118.tar.gz
We depend on Perl 5.10 features in other places.  Shorten the
lifetime of the `$desc' scalar while we're at it.
-rw-r--r--lib/PublicInbox/View.pm4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index d897aeec..9ef1f68a 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -504,9 +504,6 @@ sub attach_link ($$$$;$) {
         # spotting MUA problems:
         $ct =~ s/;.*// unless $err;
         $ct = ascii_html($ct);
-        my $desc = $part->header('Content-Description');
-        $desc = $fn unless defined $desc;
-        $desc = '' unless defined $desc;
         my $sfn;
         if (defined $fn && $fn =~ /\A$PublicInbox::Hval::FN\z/o) {
                 $sfn = $fn;
@@ -524,6 +521,7 @@ EOF
         }
         $$rv .= "[-- Attachment #$idx: ";
         my $ts = "Type: $ct, Size: $size bytes";
+        my $desc = $part->header('Content-Description') // $fn // '';
         $desc = ascii_html($desc);
         $$rv .= ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]";
         $$rv .= "</a>\n";