node-restify icon indicating copy to clipboard operation
node-restify copied to clipboard

prePath middleware strips multiple slashes to an empty string

Open mridgway opened this issue 1 year ago • 0 comments

  • [x] Used appropriate template for the issue type
  • [x] Searched both open and closed issues for duplicates of this issue
  • [x] 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.

mridgway avatar May 04 '23 18:05 mridgway