Skip to content

Commit 691ebeb

Browse files
fix(dev): use URL separators for static file paths
getStatic built the forwarded URL from path.relative, which yields backslashes on Windows. @fastify/static 10.1.4 added a path spelling guard that stats the joined path, finds the file under a different spelling, and returns 403. Normalize to forward slashes.
1 parent 579a171 commit 691ebeb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/utils/proxy.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { fileExistsAsync, isFileAsync } from '../lib/fs.js'
4040
import { getFormHandler } from '../lib/functions/form-submissions-handler.js'
4141
import { DEFAULT_FUNCTION_URL_EXPRESSION } from '../lib/functions/registry.js'
4242
import { initializeProxy as initializeImageProxy, isImageRequest } from '../lib/images/proxy.js'
43+
import { normalizeBackslash } from '../lib/path.js'
4344

4445
import {
4546
NETLIFYDEVLOG,
@@ -156,7 +157,7 @@ const getStatic = async function (pathname: string, publicFolder: string) {
156157
return false
157158
}
158159

159-
return `/${path.relative(publicFolder, file)}`
160+
return `/${normalizeBackslash(path.relative(publicFolder, file))}`
160161
}
161162

162163
const isEndpointExists = async function (endpoint: string, origin: string) {

0 commit comments

Comments
 (0)