From: Eric Wong Date: Thu, 19 May 2016 21:18:32 +0000 (+0000) Subject: view: reduce clutter for attachments w/o description X-Git-Tag: v1.0.0~523 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=9c54a95e5279826fb8a768f7d6b45cc475415f84;p=public-inbox.git view: reduce clutter for attachments w/o description For attachments without a filename or description, reduce the amount of precious screen space required to display a link to it. --- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 2303a1fa..ec5f3907 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -260,7 +260,6 @@ sub attach_link ($$$$) { my $desc = $part->header('Content-Description'); $desc = $fn unless defined $desc; $desc = '' unless defined $desc; - $desc = ': '.$desc if $desc; my $sfn; if (defined $fn && $fn =~ /\A[\w\.-]+[a-zA-Z0-9]\z/) { $sfn = $fn; @@ -269,8 +268,10 @@ sub attach_link ($$$$) { } else { $sfn = 'a.bin'; } - qq($nl[-- Attachment #$idx$desc --]\n) . - "[-- Type: $ct, Size: $size bytes --]" + my @ret = qq($nl[-- Attachment #$idx: ); + my $ts = "Type: $ct, Size: $size bytes"; + push(@ret, ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]"); + join('', @ret, ''); } sub add_text_body {