fix(workspace): use sanitized filename for non-ASCII Content-Disposition

The RFC5987 encoding path was using the original filename instead of
the sanitized version, bypassing CR/LF/null byte removal.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nicholas Tindle
2026-01-28 02:10:30 -06:00
parent e3a389ba00
commit 2b0afc348e

View File

@@ -33,7 +33,7 @@ def _sanitize_filename_for_header(filename: str) -> str:
return f'attachment; filename="{sanitized}"'
except UnicodeEncodeError:
# Use RFC5987 encoding for UTF-8 filenames
encoded = quote(filename, safe="")
encoded = quote(sanitized, safe="")
return f"attachment; filename*=UTF-8''{encoded}"