apple / swift-nio-imap

A Swift project that provides an implementation of the IMAP4rev1 protocol, built upon SwiftNIO.
Apache License 2.0
97 stars 13 forks source link

Skip BODYSTRUCTURE data when literal size limit is exceeded #759

Closed danieleggert closed 3 months ago

danieleggert commented 3 months ago

Skip BODYSTRUCTURE data when literal size limit is exceeded.

Motivation:

The original fix in #757 wasn’t able to handle ExceededLiteralSizeLimitError.

Modifications:

Use do-catch instead of parseOneOf to fall back to parseInvalidBody if parsing fails.

Added test cases.

Result:

We can now skip BODYSTRUCTURE which contain excessively large literals.

Davidde94 commented 3 months ago

Late to the party but LGTM