Skip to content

Preserve quoted-printable escapes across write boundaries - #339

Open
AryanRG wants to merge 2 commits into
Kludex:mainfrom
AryanRG:fix/quoted-printable-chunk-boundary
Open

AryanRG wants to merge 2 commits into
Kludex:mainfrom
AryanRG:fix/quoted-printable-chunk-boundary

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 17, 2026 •

Copy link
Copy Markdown

A valid quoted-printable stream can silently decode differently depending on upload chunking. When a write ends with =3D=, the current decoder retains the last two bytes instead of caching from the incomplete equals sign. It splits a completed escape, so subsequent writes cannot recover the original bytes. For example, =3D=3D should decode to == regardless of where it is split.

Cache from the position of the incomplete escape in the final two bytes, leaving completed preceding escapes intact. Add decoder and public FormParser field/file regressions across every two-write split, including soft line breaks.

Validation:

  • Six new regression cases failed on pristine main and pass with this change.
  • Full local suite: 165 passed, with 100% statement coverage under repository exclusions.
  • Ruff and mypy passed.
  • 22,278 valid-stream/chunking comparisons matched one-shot binascii decoding after the fix; the base differed in 4,219.
  • Targeted decoder and callback checks passed on Python 3.11 through 3.15. Full hosted CI and platform matrix remain unverified.

Scope note: malformed doubled-equals input has pre-existing chunk-dependent recovery. One malformed partition changes output under this fix; this PR does not claim uniform decoding of invalid encodings.

AI assistance was used to investigate, implement, test, and review this change.

View guided diff

@codspeed

codspeed Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 5 skipped benchmarks1


Comparing AryanRG:fix/quoted-printable-chunk-boundary (c738c1b) with main (51ff1a4)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply to a comment to ask cubic a question or push back. It learns from your replies.

View guided diff | Re-trigger cubic

Comment thread tests/test_multipart.py Outdated

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant