From 9c54a95e5279826fb8a768f7d6b45cc475415f84 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 19 May 2016 21:18:32 +0000 Subject: 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. --- lib/PublicInbox/View.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') 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 { -- cgit v1.2.3-24-ge0c7