File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ let ecstatic = null;
19
19
function decodePathname ( pathname ) {
20
20
const pieces = pathname . replace ( / \\ / g, '/' ) . split ( '/' ) ;
21
21
22
- return pieces . map ( ( rawPiece ) => {
22
+ return path . normalize ( pieces . map ( ( rawPiece ) => {
23
23
const piece = decodeURIComponent ( rawPiece ) ;
24
24
25
25
if ( process . platform === 'win32' && / \\ / . test ( piece ) ) {
26
26
throw new Error ( 'Invalid forward slash character' ) ;
27
27
}
28
28
29
29
return piece ;
30
- } ) . join ( '/' ) ;
30
+ } ) . join ( '/' ) ) ;
31
31
}
32
32
33
33
@@ -376,8 +376,9 @@ module.exports = function createMiddleware(_dir, _options) {
376
376
return ;
377
377
}
378
378
379
+
379
380
// 302 to / if necessary
380
- if ( ! parsed . pathname . match ( / \/ $ / ) ) {
381
+ if ( ! pathname . match ( / \/ $ / ) ) {
381
382
res . statusCode = 302 ;
382
383
const q = parsed . query ? `?${ parsed . query } ` : '' ;
383
384
res . setHeader ( 'location' , `${ parsed . pathname } /${ q } ` ) ;
You can’t perform that action at this time.
0 commit comments