Uh oh!
There was an error while loading. Please reload this page.
fix: prevent invalid Content-Type and Location headers - #7343
Closed
highoncomputers wants to merge 1 commit into
Closed
fix: prevent invalid Content-Type and Location headers#7343highoncomputers wants to merge 1 commit into
highoncomputers wants to merge 1 commit into
Conversation
- res.set('Content-Type', unrecognized) no longer sets header to
literal 'false' when mime.contentType() returns false
- res.redirect(undefined) now returns early instead of sending a
malformed Location: undefined header
Closes#7034Closes#6941
Co-authored-by: dougwilson <dougwilson@users.noreply.github.com>krzysdz
commented
Jul 1, 2026
Contributor
|
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 freeto 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.
Two small fixes in
lib/response.js:res.set('Content-Type', value)with an unrecognized type (fixesres.set('Content-Type') silently sets header to literal string 'false' for unknown types #7034)When
mime.contentType(value)returnsfalsefor unknown types, the header was set to the literal stringfalse. Added a fallback to the original value.res.redirect(undefined)sending malformedLocation: undefined(fixesres.redirect(undefined) sends invalid Location: undefined header #6941)Added early return when
addressis falsy or not a string, preventingencodeUrl(undefined)from setting an invalid Location header.Closes#7034
Closes#6941