mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-30 09:28:19 -05:00
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:
@@ -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}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user