Skip to content

Commit

Permalink
handle accented characters (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored and lukeed committed Sep 3, 2018
1 parent 7a8c8f7 commit 250f296
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/sirv/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = function (dir, opts={}) {

if (opts.dev) {
return function (req, res, next) {
let uri = req.path || req.pathname || parseurl(req).pathname;
let uri = decodeURIComponent(req.path || req.pathname || parseurl(req).pathname);
let arr = uri.includes('.') ? [uri] : toAssume(uri, extensions);
let file = arr.map(x => join(dir, x)).find(fs.existsSync);
if (!file) return next ? next() : notFound(res);
Expand All @@ -72,7 +72,7 @@ module.exports = function (dir, opts={}) {
};
cc && (headers['cache-control'] = cc);
opts.etag && (headers['etag'] = toEtag(stats));
FILES['/' + str.replace(/\\+/g, '/')] = { abs, stats, headers };
FILES['/' + encodeURIComponent(str.replace(/\\+/g, '/'))] = { abs, stats, headers };
});

return function (req, res, next) {
Expand Down

0 comments on commit 250f296

Please sign in to comment.