restify / restify/node-restify
prePath middleware strips multiple slashes to an empty string
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 975
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 5
Description
- Used appropriate template for the issue type
- Searched both open and closed issues for duplicates of this issue
- Title adequately and concisely reflects the feature or the bug
Restify Version: master
Node.js Version: 16.17.0
Expected behaviour
prePath middleware should reduce path /// to /.
Actual behaviour
prePath middleware reduces /// to `` (empty string).
Repro case
Test case: https://github.com/restify/node-restify/compare/master...mridgway:node-restify:prePathEmptyString
Cause
This code will parse an empty string which returns null for pathname. The router will then assert the pathname as a string and throw.
Are you willing and able to fix this?
Yes, if/when I have some time.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked prePathEmptyString reproduction, then inspect lib/request.js around line 427 and the pathname assertion in lib/routerRegistryRadix.js around line 97. Confirm that the regression is covered and that prePath handling leaves /// as / rather than an empty pathname that causes the router to throw.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100