From f9b63d4cd4d5a58c37ed8464b2d335a6932cc118 Mon Sep 17 00:00:00 2001
From: Eric Wong <e@yhbt.net>
Date: Sat, 4 Apr 2020 08:03:16 +0000
Subject: [PATCH] view: use defined-or operator to simplify checks

We depend on Perl 5.10 features in other places.  Shorten the
lifetime of the `$desc' scalar while we're at it.
---
 lib/PublicInbox/View.pm | 4 +---
 1 file changed, 1 insertion(+), 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";
-- 
2.51.0