Commit 10d7802
fix(models): honour declared charset in RFC 5987 filename* parsing
The Content-Disposition filename* branch captured the charset in its
regex but discarded it, so unquote() always decoded with UTF-8. RFC 5987
also permits ISO-8859-1, so an ISO-8859-1 percent-encoded filename
decoded to mojibake despite the helper claiming RFC 5987 support.
- Decode the extended value with its declared charset; fall back to
UTF-8 for an unknown or empty charset label (LookupError) instead of
raising.
- Strip surrounding quotes off non-conformant quoted filename* values.
- Add tests for ISO-8859-1, an unknown charset, and a quoted filename*.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent def9b92 commit 10d7802
2 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | | - | |
| 84 | + | |
83 | 85 | | |
84 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
507 | 513 | | |
508 | 514 | | |
509 | 515 | | |
| |||
0 commit comments