lukeed / sirv

An optimized middleware & CLI application for serving static files~!
MIT License
1.07k stars 58 forks source link

bug accessing stored decoded request #115

Closed benmccann closed 3 years ago

benmccann commented 3 years ago

@hannoeru suggested in https://github.com/vitejs/vite/pull/4728#issuecomment-905913441 that he found a bug here:

https://github.com/lukeed/sirv/blob/83ee458eac97258952e375766834800fba892408/packages/sirv/index.js#L163

I think perhaps that line should change to the following?

let pathname = !!req._decoded && req._parsedUrl.pathname || parse(req, true).pathname;