fix: workaround illegal extra bodystructure segments in parseFetch #904
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently I came across an odd error in the parser, which looked like this:
It happened when I was trying to fetch some old messages from an account on mail[.]ru server.
I enabled debug output plus added a few logs from myself, trying to look at what exactly caused the error, and here is what it looked like:
I'm not an expert in IMAP, but that second array with that alternative bodystructure seemed wrong to me. I could not find any reference saying that this is a standard behavior. It looks more like a bug in that specific IMAP server implementation.
The exception turned out quite hard to fight, as it's happening deep in the asynchronous code. And also I didn't care too much about the integrity of this this specific email, so this workaround served me well.
Not sure how useful it is here though, since I'm seemingly the only person so far, facing this specific problem.