fix: prefer RFC 5987 filename* in hx-download - #4043
Open
manwithacat wants to merge 1 commit into
Open
Conversation
parseFilename() matched the first filename= token, so a UTF-8 filename* was ignored when an ASCII filename= fallback was also present. Closes bigskysoftware#4020
manwithacat
added a commit
to manwithacat/htmx
that referenced
this pull request
Sep 7, 2026
Before/after iframes against 7f9160f for PRs bigskysoftware#4043 bigskysoftware#4044 bigskysoftware#4045.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
parseFilename()used/filename\*?=/, so the firstfilename=token won. When a server sent both an ASCII fallback andfilename*=UTF-8''…, the UTF-8 name was ignored.Corresponding issue: #4020
Demo: https://manwithacat.github.io/htmx/demos/hx-download-utf8-filename/
Testing
Added tests for dual
filename=+filename*(the reported header) andfilename*alone.Local
npm test(Chromium, same as CIhtmx_tests): 87 files, 1740 passed, 0 failed, 5 skipped.Checklist
four-devfilename*behaviourparseFilenameunit-checked with the reporter's header