util: make MIMEParams accessors case-insensitive by watilde · Pull Request #64123 · nodejs/node · GitHub
Skip to content

util: make MIMEParams accessors case-insensitive#64123

Open
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:fix/mime-params-case-insensitive
Open

util: make MIMEParams accessors case-insensitive#64123
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:fix/mime-params-case-insensitive

Conversation

@watilde

@watilde watilde commented Jun 25, 2026

Copy link
Copy Markdown
Member

MIME parameter names are case-insensitive and the parser already ASCII-lowercases them, but MIMEParams.get(), has(), delete() and set() compared against the raw argument. As a result a parsed parameter was unreachable by the casing the caller used (e.g. params.get('Charset') returned null for "Charset=utf-8"), and set() could create duplicate, case-colliding parameters.

Lowercase the name in the accessors to match the parser, consistent with the whatwg-mimetype reference implementation.

MIME parameter names are case-insensitive and the parser already
ASCII-lowercases them, but MIMEParams.get(), has(), delete() and set()
compared against the raw argument. As a result a parsed parameter was
unreachable by the casing the caller used (e.g. params.get('Charset')
returned null for "Charset=utf-8"), and set() could create duplicate,
case-colliding parameters.

Lowercase the name in the accessors to match the parser, consistent with
the whatwg-mimetype reference implementation.

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants