From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS12876 163.172.0.0/16 X-Spam-Status: No, score=-0.9 required=3.0 tests=AWL,BAYES_00, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_ZBI,RCVD_IN_XBL,SPF_FAIL,SPF_HELO_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from 80x24.org (torrelay6.tomhek.net [163.172.38.175]) by dcvr.yhbt.net (Postfix) with ESMTP id A8ACF20229 for ; Sun, 14 Aug 2016 10:21:24 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH 04/11] www: do not double-clean Message-IDs from internal DBs Date: Sun, 14 Aug 2016 10:21:10 +0000 Message-Id: <20160814102117.11456-4-e@80x24.org> In-Reply-To: <20160814102117.11456-1-e@80x24.org> References: <20160814102117.11456-1-e@80x24.org> List-Id: Ensure we always strip one level of '<>' from Message-IDs, since our internal SQLite, Xapian, and SHA-1 storage all assume that. Realistically, we may screw up if somebody has '<<' or '>>', but those are screwed up mail clients. --- lib/PublicInbox/Feed.pm | 3 +-- lib/PublicInbox/Hval.pm | 1 - lib/PublicInbox/View.pm | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 232a91c..25fec10 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -266,8 +266,7 @@ sub feed_entry { my $midurl = $feed_opts->{midurl}; my $header_obj = $mime->header_obj; - my $mid = $header_obj->header_raw('Message-ID'); - defined $mid or return; + my $mid = mid_clean($header_obj->header_raw('Message-ID')); $mid = PublicInbox::Hval->new_msgid($mid); my $href = $midurl . $mid->{href}. '/'; diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm index ab05238..b354aa4 100644 --- a/lib/PublicInbox/Hval.pm +++ b/lib/PublicInbox/Hval.pm @@ -32,7 +32,6 @@ sub new { sub new_msgid { my ($class, $msgid) = @_; - $msgid = mid_clean($msgid); $class->new($msgid, mid_escape($msgid)); } diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 47ffc62..5b352d1 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -491,7 +491,7 @@ sub _msg_html_prepare { $ctx->{-upfx} = '../'; } my @title; - my $mid = $hdr->header_raw('Message-ID'); + my $mid = mid_clean($hdr->header_raw('Message-ID')); $mid = PublicInbox::Hval->new_msgid($mid); foreach my $h (qw(From To Cc Subject Date)) { my $v = $hdr->header($h); -- EW