|
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('/')); |
Windows pathname parsing is incorrect
|
if (!pathname.match(/\/$/)) { |
|
res.statusCode = 302; |
|
const q = parsed.query ? `?${parsed.query}` : ''; |
|
res.setHeader('location', `${parsed.pathname}/${q}`); |
|
res.end(); |
|
return; |
|
} |
Or modify here to
if (!parsed.pathname.match(/\/$/)) {
res.statusCode = 302;
const q = parsed.query ? `?${parsed.query}` : '';
res.setHeader('location', `${parsed.pathname}/${q}`);
res.end();
return;
}
node-ecstatic/lib/ecstatic.js
Lines 23 to 31 in ae7a39b
Windows pathname parsing is incorrect
node-ecstatic/lib/ecstatic.js
Lines 393 to 399 in ae7a39b
Or modify here to