]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: single id="t" for multi-Subject messages
authorEric Wong <e@yhbt.net>
Sat, 15 Feb 2020 09:46:34 +0000 (09:46 +0000)
committerEric Wong <e@yhbt.net>
Sun, 16 Feb 2020 00:06:32 +0000 (00:06 +0000)
While multi-Subject messages are unfortunate, try not to
generate confusing/invalid HTML with multiple elements
having the same HTML id attribute.

lib/PublicInbox/View.pm

index dcaee1aeaeca6c8fdb8c6c57e9011693c04421f8..45c191dbe6a942a5a0b2e3edf2574d8f482e221b 100644 (file)
@@ -651,16 +651,15 @@ sub _msg_page_prepare_obuf {
        }
        my @subj = $hdr->header('Subject');
        if (@subj) {
-               for my $v (@subj) {
+               my $v = ascii_html(shift @subj);
+               obfuscate_addrs($obfs_ibx, $v) if $obfs_ibx;
+               $rv .= 'Subject: ';
+               $rv .= $over ? qq(<a\nhref="#r"\nid=t>$v</a>\n) : "$v\n";
+               $title[0] = $v;
+               for $v (@subj) { # multi-Subject message :<
                        $v = ascii_html($v);
                        obfuscate_addrs($obfs_ibx, $v) if $obfs_ibx;
-                       $rv .= 'Subject: ';
-                       if ($over) {
-                               $rv .= qq(<a\nhref="#r"\nid=t>$v</a>\n);
-                       } else {
-                               $rv .= "$v\n";
-                       }
-                       $title[0] //= $v;
+                       $rv .= "Subject: $v\n";
                }
        } else { # dummy anchor for thread skeleton at bottom of page
                $rv .= qq(<a\nhref="#r"\nid=t></a>) if $over;