user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] www: do not double-clean Message-IDs from internal DBs
@ 2016-08-14 11:10  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-08-14 11:10 UTC (permalink / raw)
  To: meta

Ensure we usually strip one level of '<>' from Message-IDs,
since our internal SQLite, Xapian, and SHA-1 storage all
assume that.

Realistically, we screw up if somebody has '<<' or '>>',
but those are screwed up mail clients and we can deal with
it another time.  Currently, this means some messages with
'>>' in References or Message-Id are not handled correctly,
yet, but we match the behavior of Mail::Thread in keeping
the extra '>'.
---
 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 7249606..77acecd 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -31,7 +31,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 34f97c7..6f79f60 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


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-08-14 11:10  7% [PATCH] www: do not double-clean Message-IDs from internal DBs Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).