From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DDF0A1F4B9 for ; Sat, 25 Jan 2020 02:47:08 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] mbox: handle empty subjects after dropping "Re:" prefix Date: Sat, 25 Jan 2020 02:47:08 +0000 Message-Id: <20200125024708.10552-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 {