Skip to content

Commit d0e2bcf

Browse files
committed
Ho hum
1 parent b1ad801 commit d0e2bcf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/ecstatic.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ let ecstatic = null;
1919
function decodePathname(pathname) {
2020
const pieces = pathname.replace(/\\/g, '/').split('/');
2121

22-
return pieces.map((rawPiece) => {
22+
return path.normalize(pieces.map((rawPiece) => {
2323
const piece = decodeURIComponent(rawPiece);
2424

2525
if (process.platform === 'win32' && /\\/.test(piece)) {
2626
throw new Error('Invalid forward slash character');
2727
}
2828

2929
return piece;
30-
}).join('/');
30+
}).join('/'));
3131
}
3232

3333

@@ -376,8 +376,9 @@ module.exports = function createMiddleware(_dir, _options) {
376376
return;
377377
}
378378

379+
379380
// 302 to / if necessary
380-
if (!parsed.pathname.match(/\/$/)) {
381+
if (!pathname.match(/\/$/)) {
381382
res.statusCode = 302;
382383
const q = parsed.query ? `?${parsed.query}` : '';
383384
res.setHeader('location', `${parsed.pathname}/${q}`);

0 commit comments

Comments
 (0)