Skip to content

Commit

Permalink
Ho hum
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhbrook committed May 3, 2019
1 parent b1ad801 commit d0e2bcf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/ecstatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ let ecstatic = null;
function decodePathname(pathname) {
const pieces = pathname.replace(/\\/g, '/').split('/');

return pieces.map((rawPiece) => {
return path.normalize(pieces.map((rawPiece) => {
const piece = decodeURIComponent(rawPiece);

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

return piece;
}).join('/');
}).join('/'));
}


Expand Down Expand Up @@ -376,8 +376,9 @@ module.exports = function createMiddleware(_dir, _options) {
return;
}


// 302 to / if necessary
if (!parsed.pathname.match(/\/$/)) {
if (!pathname.match(/\/$/)) {
res.statusCode = 302;
const q = parsed.query ? `?${parsed.query}` : '';
res.setHeader('location', `${parsed.pathname}/${q}`);
Expand Down

0 comments on commit d0e2bcf

Please sign in to comment.