This repository was archived by the owner on Jan 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const { createReadableStreamFromReadable } = require("@remix-run/node")
10
10
*/
11
11
exports . serveAsset = async function serveAsset ( request , publicFolder ) {
12
12
const url = new URL ( request . url )
13
- const fullFilePath = path . join ( publicFolder , url . pathname )
13
+ const fullFilePath = path . join ( publicFolder , decodeURIComponent ( url . pathname ) )
14
14
if ( ! fullFilePath . startsWith ( publicFolder ) ) return
15
15
16
16
const stat = await fs . promises . stat ( fullFilePath ) . catch ( ( ) => undefined )
Original file line number Diff line number Diff line change
1
+ This is a file with spaces in the path
Original file line number Diff line number Diff line change @@ -109,3 +109,15 @@ test.skip(
109
109
} ,
110
110
1000 * 30 ,
111
111
)
112
+
113
+ test ( "can load public assets that contain whitespace in their path" , async ( ) => {
114
+ const { window, dispose } = await launch ( )
115
+
116
+ await window . goto ( "http://localhost/with spaces.txt" )
117
+
118
+ await expect ( window . locator ( "body" ) ) . toHaveText (
119
+ "This is a file with spaces in the path" ,
120
+ )
121
+
122
+ await dispose ( )
123
+ } )
You can’t perform that action at this time.
0 commit comments