apache / apache/ponymail

Bug: import/archive don't unfold headers before storage in ES

Open
#234 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
80
Forks
32
PR merge metrics
No merged PRs in 30d

Description

The mail parser returns the headers as-is, including line-wraps.

This is what is wanted for the raw email source, but is not really suitable for fields such as In-Reply-To, References etc.

It seems there is no unfold method in the Python email or mailbox modules, so it looks like it is necessary to write one.

Header values that have not been folded cannot contain CRLF, so unfolding should just be a matter of stripping these out. There should be no need to check if the CRLF is followed by whitespace (assuming the folding has been done correctly).

It might make sense to compress runs of WS to a single space in case there is some variation.
This should make it easier to match things like In-Reply-To.

Contributor guide

No contributing guide indexed for this repository

Research direction

Trace the import/archive path that writes headers to ES, then inspect the Python email and mailbox modules' handling of folded headers. Done means fields such as In-Reply-To and References are unfolded before storage while the raw email source remains unchanged; verify that matching works with folded input.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, python
Domain
backend, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.