Skip to content

Commit df3bb31

Browse files
authored
fix(sirv): use decoded value directly (#116)
* fix(sirv): use decoded value directly * chore: bump `polka/url` version again
1 parent bb2d0e3 commit df3bb31

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/sirv/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ export default function (dir, opts={}) {
160160
if (brots && /(br|brotli)/i.test(val)) extns.unshift(...brots);
161161
extns.push(...extensions); // [...br, ...gz, orig, ...exts]
162162

163-
// todo: fix me later (dangle in parser)
164-
let pathname = !!req._decoded && req._parsedUrl && req._parsedUrl.pathname || parse(req, true).pathname;
163+
let pathname = typeof req._decoded === 'string' ? req._decoded : parse(req, true).pathname;
165164
let data = lookup(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup(fallback, extns);
166165
if (!data) return next ? next() : isNotFound(req, res);
167166

packages/sirv/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"node": ">= 10"
2121
},
2222
"dependencies": {
23-
"@polka/url": "^1.0.0-next.17",
23+
"@polka/url": "^1.0.0-next.19",
2424
"mime": "^2.3.1",
2525
"totalist": "^1.0.0"
2626
}
27-
}
27+
}

0 commit comments

Comments
 (0)