Skip to content

Commit

Permalink
Merge pull request #24 from HorusGoul/main
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMapleLeaf authored Dec 19, 2023
2 parents 02187f0 + 177587e commit e698a92
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/asset-files.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { createReadableStreamFromReadable } = require("@remix-run/node")
*/
exports.serveAsset = async function serveAsset(request, publicFolder) {
const url = new URL(request.url)
const fullFilePath = path.join(publicFolder, url.pathname)
const fullFilePath = path.join(publicFolder, decodeURIComponent(url.pathname))
if (!fullFilePath.startsWith(publicFolder)) return

const stat = await fs.promises.stat(fullFilePath).catch(() => undefined)
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/test-app/public/with spaces.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a file with spaces in the path
12 changes: 12 additions & 0 deletions tests/integration.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,15 @@ test.skip(
},
1000 * 30,
)

test("can load public assets that contain whitespace in their path", async () => {
const { window, dispose } = await launch()

await window.goto("http://localhost/with spaces.txt")

await expect(window.locator("body")).toHaveText(
"This is a file with spaces in the path",
)

await dispose()
})

0 comments on commit e698a92

Please sign in to comment.