4 Commits

Author SHA1 Message Date
Taylor Wilsdon
894564f378 refac tests 2026-03-17 15:32:14 -04:00
Taylor Wilsdon
a87ac1737d add test 2026-03-17 14:34:21 -04:00
github-actions[bot]
3f9821b525 style: auto-fix ruff lint and format 2026-02-24 14:29:22 +00:00
mickey-mikey
ffeba1f2f3 fix: add O_BINARY flag to os.open for Windows attachment writes
Fixes #494 - Windows attachment corruption for PNG/PDF files.

On Windows, os.open() defaults to text mode, which translates LF (0x0a)
bytes to CRLF (0x0d 0x0a) during os.write(). This corrupts any binary
attachment containing 0x0a bytes (PNG headers, PDFs, etc.).

The fix adds os.O_BINARY to the os.open() flags using the standard
getattr(os, 'O_BINARY', 0) idiom, which returns the flag on Windows
and 0 (no-op) on platforms where it doesn't exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:45:37 +11:00