File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ let ecstatic = null;
1919function 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 } ` ) ;
You can’t perform that action at this time.
0 commit comments