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")
1010 */
1111exports . serveAsset = async function serveAsset ( request , publicFolder ) {
1212 const url = new URL ( request . url )
13- const fullFilePath = path . join ( publicFolder , url . pathname )
13+ const fullFilePath = path . join ( publicFolder , decodeURIComponent ( url . pathname ) )
1414 if ( ! fullFilePath . startsWith ( publicFolder ) ) return
1515
1616 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(
109109 } ,
110110 1000 * 30 ,
111111)
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