From 0cf1c8b305e15d9ca9869c624a71c96b96a7a5cc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Jan 2020 02:47:08 +0000 Subject: mbox: handle empty subjects after dropping "Re:" prefix 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 1f9ac6ec..cf93e7db 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -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 { -- cgit v1.2.3-24-ge0c7