restify / node-restify

The future of Node.js REST development
http://restify.com
MIT License
10.71k stars 984 forks source link

prePath middleware strips multiple slashes to an empty string #1953

Open mridgway opened 1 year ago

mridgway commented 1 year ago

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.