@@ -17,7 +17,18 @@ function decode(input) {
1717 return querystring . unescape ( input ) ;
1818}
1919
20- const memoizedParse = memorize ( parse , undefined , ( value ) => {
20+ const memoizedParseWithIndex = memorize ( parse , undefined , ( value ) => {
21+ if ( value . pathname ) {
22+ value . pathname = decode ( value . pathname ) ;
23+ if ( value . pathname [ value . pathname . length - 1 ] === "/" ) {
24+ value . pathname = path . join ( value . pathname , "index.html" ) ;
25+ }
26+ }
27+
28+ return value ;
29+ } ) ;
30+
31+ const memoizedParseWithoutIndex = memorize ( parse , undefined , ( value ) => {
2132 if ( value . pathname ) {
2233 value . pathname = decode ( value . pathname ) ;
2334 }
@@ -63,14 +74,7 @@ function getFilenameFromUrl(context, url, extra = {}) {
6374
6475 try {
6576 // The `url` property of the `request` is contains only `pathname`, `search` and `hash`
66- urlObject = memoizedParse ( url , false , true ) ;
67-
68- if (
69- urlObject ?. pathname &&
70- urlObject . pathname [ urlObject . pathname . length - 1 ] === "/"
71- ) {
72- urlObject . pathname = path . join ( urlObject . pathname , "index.html" ) ;
73- }
77+ urlObject = memoizedParseWithIndex ( url , false , true ) ;
7478 } catch {
7579 return ;
7680 }
@@ -82,7 +86,7 @@ function getFilenameFromUrl(context, url, extra = {}) {
8286 let publicPathObject ;
8387
8488 try {
85- publicPathObject = memoizedParse (
89+ publicPathObject = memoizedParseWithoutIndex (
8690 publicPath !== "auto" && publicPath ? publicPath : "/" ,
8791 false ,
8892 true ,
0 commit comments