diff options
author | Eric Wong <e@80x24.org> | 2023-11-27 22:20:59 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-28 05:20:13 +0000 |
commit | fd254c022da9e0f3e6ce793fc38e0fa2fe1ca683 (patch) | |
tree | ef3badb85ff33b0df019002ded408226bd9c8261 /lib/PublicInbox/SearchIdx.pm | |
parent | 577e421a0815e66f965bd4317adad5aeea3cc52a (diff) | |
download | public-inbox-fd254c022da9e0f3e6ce793fc38e0fa2fe1ca683.tar.gz |
While MTAs seem to stop '\0' from appearing in headers, users fetching archives via git remain susceptible to having '\0' land in archives. So we'll filter them out of Xapian and SQLite DBs to avoid interopability problems with CLI tools since there's no known messages in lore or any of my archives which feature them. Avoiding '\0' will ensure all indexed Message-IDs and List-Ids can be specified from the command-line (although some characters will still require $(printf) contortions). As with Message-ID, List-Id fields with /\n\t\r/ characters will also be stripped for indexing. I will assume whatever went wrong with the References: header in <https://public-inbox.org/git/656C30A1EFC89F6B2082D9B6@localhost/raw> could also happen to the List-Id header. This is inspired by commit aca47e05a6026c12c768753c87e6ff769ef6bee4 (Import: Don't copy nulls from emails into git, 2018-07-07)
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdx.pm | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 32598b7c..f569428c 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -414,6 +414,7 @@ sub index_list_id ($$$) { for my $l ($hdr->header_raw('List-Id')) { $l =~ /<([^>]+)>/ or next; my $lid = lc $1; + $lid =~ tr/\n\t\r\0//d; # same rules as Message-ID $doc->add_boolean_term('G' . $lid); index_phrase($self, $lid, 1, 'XL'); # probabilistic } |