]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mbox: handle empty subjects after dropping "Re:" prefix
authorEric Wong <e@yhbt.net>
Sat, 25 Jan 2020 02:47:08 +0000 (02:47 +0000)
committerEric Wong <e@yhbt.net>
Sat, 25 Jan 2020 09:00:39 +0000 (09:00 +0000)
We can't pass empty strings to `to_filename' without
triggering warnings, and `to_filename' on an empty string
makes no sense.

lib/PublicInbox/Mbox.pm

index 1f9ac6ec88cfd1a0989a0da5f7d44ab8590230cd..cf93e7dbb64b21cfe57d417bf75902829013512b 100644 (file)
@@ -24,11 +24,10 @@ sub subject_fn ($) {
        # no need for full Email::MIME, here
        if ($fn =~ /=\?/) {
                eval { $fn = Encode::decode('MIME-Header', $fn) };
-               $fn = 'no-subject' if $@;
+               return 'no-subject' if $@;
        }
        $fn =~ s/^re:\s+//i;
-       $fn = to_filename($fn);
-       $fn eq '' ? 'no-subject' : $fn;
+       $fn eq '' ? 'no-subject' : to_filename($fn);
 }
 
 sub mb_stream {