Skip to content

Preserve binary SOAP attachment content - #1503

Open
KennyMcSimpson wants to merge 1 commit into
mvantellingen:mainfrom
KennyMcSimpson:fix/preserve-binary-attachment-content
Open

KennyMcSimpson wants to merge 1 commit into
mvantellingen:mainfrom
KennyMcSimpson:fix/preserve-binary-attachment-content

Conversation

@KennyMcSimpson

Copy link
Copy Markdown

Binary SOAP attachments lose leading and trailing CR/LF bytes because Attachment.content strips them after MultipartDecoder has already removed the MIME boundary framing. This can corrupt downloaded files and invalidate signatures, as reported in #1249 and #1481.

Return binary content unchanged, retaining the existing base64 decoding behavior. Add seven tests built from actual multipart bytes, covering leading/trailing CRLF, an all-CRLF payload, non-text bytes, ordinary content, and empty content. Update three existing fixture expectations to retain the extra CRLF that belongs to their payload; the fixture without that extra CRLF keeps its original expectation.

Validation:

  • On unchanged source, five new cases fail and two controls pass.
  • Full suites with the project's locked development dependencies on Python 3.10 and 3.13: 483 passed, 17 skipped each.
  • Project Ruff lint and format checks, sdist/wheel builds, and Twine checks pass.
  • Python's independent email.BytesParser preserves the same bytes for all seven multipart cases. RFC 2046 section 5.1.1 confirms that when two CRLF sequences precede a boundary, the first belongs to the body.

Fixes #1249.
Fixes #1481.

AI assistance: prepared and validated with OpenAI Codex. These are local checks; no human review or successful upstream CI is claimed.

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.

MessagePack strips newlines in binary attachment content SOAP binary attachments with leading/trailing whitespace break when downloaded

1 participant