File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,15 +20,15 @@ let ecstatic = null;
2020function decodePathname ( pathname ) {
2121 const pieces = pathname . replace ( / \\ / g, '/' ) . split ( '/' ) ;
2222
23- return pieces . map ( ( rawPiece ) => {
23+ return path . normalize ( pieces . map ( ( rawPiece ) => {
2424 const piece = decodeURIComponent ( rawPiece ) ;
2525
2626 if ( process . platform === 'win32' && / \\ / . test ( piece ) ) {
2727 throw new Error ( 'Invalid forward slash character' ) ;
2828 }
2929
3030 return piece ;
31- } ) . join ( '/' ) ;
31+ } ) . join ( '/' ) ) ;
3232}
3333
3434
@@ -388,8 +388,9 @@ module.exports = function createMiddleware(_dir, _options) {
388388 return ;
389389 }
390390
391+
391392 // 302 to / if necessary
392- if ( ! parsed . pathname . match ( / \/ $ / ) ) {
393+ if ( ! pathname . match ( / \/ $ / ) ) {
393394 res . statusCode = 302 ;
394395 const q = parsed . query ? `?${ parsed . query } ` : '' ;
395396 res . setHeader ( 'location' , `${ parsed . pathname } /${ q } ` ) ;
You can’t perform that action at this time.
0 commit comments