Repository navigation
Conversation
This branch has not been deployed
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.
Pre-Submission Checklist
make prepush, run one by one on Windows)Issues
Closes:
pre.dedupeSlashes()ran its regex over the wholereq.url. So//inside the query string was collapsed too, and?next=http://example.com/homereached the handler ashttp:/example.com/home.Changes
lib/plugins/pre/dedupeSlashes.js: splitreq.urlat the first?or#. Duplicate slashes are removed from the path only. The rest is appended back unchanged.test/plugins/dedupeSlashes.test.js: two new tests. One checks that//foo//bar//?next=http://example.com//xbecomes/foo/bar/?next=http://example.com//x. One checks that an empty query (//foo//bar//?) is kept as/foo/bar/?.Behavior change: the path is cleaned exactly as before, so routing does not change. Anything from the first
?or#on is now left byte for byte. A request like//foo?a=//bused to reach the handler as/foo?a=/band now reaches it as/foo?a=//b. A raw#fragment (clients do not normally send one) is also left as is.pre.sanitizePath()has the same problem with the query string. I did not touch it here because PR #1960 is open on that file.Testing
On Windows 11 with Node 24.19.0:
mocha test/plugins/dedupeSlashes.test.js test/plugins/query.test.js: 16 passing.mocha test/plugins/dedupeSlashes.test.jsgives 4 passing, 1 failing (expected '/foo/bar/?next=http:/example.com/x' to equal '/foo/bar/?next=http://example.com//x').mocha test/plugins/*.test.js: 199 passing, 20 failing. Without this change it is 197 passing and the same 20 failing (staticFiles and cpuUsageThrottle, which fail on my Windows machine).nodeunit test/*.test.js: 1/897 assertions failed (listen and close (socketPath), a Unix socket test that fails on Windows).make check-lintandmake check-style(eslint over the repo): 0 errors.Validated with Claude Opus 5.5.