Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit e698a92

Browse files
authored
Merge pull request #24 from HorusGoul/main
2 parents 02187f0 + 177587e commit e698a92

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/asset-files.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { createReadableStreamFromReadable } = require("@remix-run/node")
1010
*/
1111
exports.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)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a file with spaces in the path

tests/integration.test.mts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
})

0 commit comments

Comments
 (0)