Skip to content

Remove RFC 2047 encoding from Content-Disposition filename#36328

Open
tobifasc wants to merge 1 commit intospring-projects:mainfrom
tobifasc:main
Open

Remove RFC 2047 encoding from Content-Disposition filename#36328
tobifasc wants to merge 1 commit intospring-projects:mainfrom
tobifasc:main

Conversation

@tobifasc
Copy link

Appendix C.1 of RFC 2066 and Section 5 of RFC 2047 describe that an "encoded-word" (as described in RFC 2047) must not be used as parameter of a Content-Disposition header.

The current implementation in ContentDisposition does however encode the fallback filename parameter using the mechanism described in RFC 2047 (given that the charset is set to something other than US_ASCII).
Related discussion: #29861

This PR updates the Content-Disposition header creation logic to use only ISO-8859-1 characters for the fallback filename parameter instead. Non-compatible characters are replaced with ?. The "full" filename is still present in the filename* parameter.

This does not remove the ability to parse RFC 2047 encoded headers.

Updates the Content-Disposition header creation logic to use only
ISO-8859-1 characters for the fallback 'filename' parameter instead of
RFC 2047 encoded strings. Non-compatible characters are replaced with '?'.

This does not remove the ability to parse RFC 2047 encoded filenames.

Signed-off-by: Tobias Fasching <tobias.fasching@outlook.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants