djc / tokio-imap

Tokio-based IMAP implementation
Apache License 2.0
123 stars 42 forks source link

Fix parsing of NIL metadata values #159

Closed link2xt closed 9 months ago

link2xt commented 9 months ago

map_opt always fails if second argument returns None.

codecov[bot] commented 9 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (2c8f6cb) 79.00% compared to head (8e4faea) 79.05%.

Files Patch % Lines
imap-proto/src/parser/rfc5464.rs 86.66% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #159 +/- ## ========================================== + Coverage 79.00% 79.05% +0.05% ========================================== Files 22 22 Lines 3653 3667 +14 ========================================== + Hits 2886 2899 +13 - Misses 767 768 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

djc commented 9 months ago

Thanks!

djc commented 9 months ago

BTW I'm open to PRs that make the parser recoverable where possible.

link2xt commented 9 months ago

BTW I'm open to PRs that make the parser recoverable where possible.

I just don't know how to do this, probably the best way is to add last-resort garbage parser that tries to skip one unknown response if all other parsers fail.

djc commented 9 months ago

IIRC it's probably possible to impose some meta structure that just looks for \r\n and knows how to work around DATA blocks so it can recover to the next \r\n.