about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-19 21:18:32 +0000
committerEric Wong <e@80x24.org>2016-05-19 21:24:58 +0000
commit9c54a95e5279826fb8a768f7d6b45cc475415f84 (patch)
tree8a194a61f4e02d208800d4e607f90277182ad496 /lib/PublicInbox
parente197631142c0236e59460310aaecb38ccacfad2e (diff)
downloadpublic-inbox-9c54a95e5279826fb8a768f7d6b45cc475415f84.tar.gz
For attachments without a filename or description, reduce
the amount of precious screen space required to display
a link to it.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/View.pm7
1 files changed, 4 insertions, 3 deletions
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<a\nhref="$upfx$idx-$sfn">[-- Attachment #$idx$desc --]\n) .
-        "[-- Type: $ct, Size: $size bytes --]</a>"
+        my @ret = qq($nl<a\nhref="$upfx$idx-$sfn">[-- Attachment #$idx: );
+        my $ts = "Type: $ct, Size: $size bytes";
+        push(@ret, ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]");
+        join('', @ret, '</a>');
 }
 
 sub add_text_body {