Skip to content

Upgrade content-type#7234

Open
blakeembrey wants to merge 1 commit into
masterfrom
be/upgrade-content-type
Open

Upgrade content-type#7234
blakeembrey wants to merge 1 commit into
masterfrom
be/upgrade-content-type

Conversation

@blakeembrey
Copy link
Copy Markdown
Member

Only used in

express/lib/utils.js

Lines 225 to 238 in f873ac2

exports.setCharset = function setCharset(type, charset) {
if (!type || !charset) {
return type;
}
// parse type
var parsed = contentType.parse(type);
// set charset
parsed.parameters.charset = charset;
// format type
return contentType.format(parsed);
};
. There will be a minor change in behavior for invalid content-type headers as parse no longer fails but instead does its best, but the format below it will validate anything that was parsed.

This only leaves edge cases like unterminated " or trailing content after ""xyz as omitted. 100% backward compatibility can be achieved for these edge cases if its wanted, but I'm not sure it's worth it.

Version 2 of content-type was focused on performance and since this is the only method in the package using it, it's not a critical upgrade and would only serve to deduplicate with any dependencies that also upgrade.

@blakeembrey blakeembrey requested a review from a team May 11, 2026 21:19
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcontent-type@​2.0.0911009089100

View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant