From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5FF7F1FD55 for ; Thu, 19 May 2016 21:28:29 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/6] view: reduce clutter for attachments w/o description Date: Thu, 19 May 2016 21:28:47 +0000 Message-Id: <20160519212847.4822-6-e@80x24.org> In-Reply-To: <20160519212847.4822-1-e@80x24.org> References: <20160519212552.4530-1-e@80x24.org> <20160519212847.4822-1-e@80x24.org> List-Id: 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(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 2303a1f..ec5f390 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 { -- EW