mirror of https://github.com/nuxt/nuxt.git
fix(nitro): handle decoding static filenames (#3541)
This commit is contained in:
parent
5b7fbc1569
commit
91256f5e76
|
@ -19,7 +19,7 @@ export function staticAssets (context: NitroContext) {
|
||||||
const etag = createEtag(readFileSync(fullPath))
|
const etag = createEtag(readFileSync(fullPath))
|
||||||
const stat = statSync(fullPath)
|
const stat = statSync(fullPath)
|
||||||
|
|
||||||
assets['/' + id] = {
|
assets['/' + decodeURIComponent(id)] = {
|
||||||
type,
|
type,
|
||||||
etag,
|
etag,
|
||||||
mtime: stat.mtime.toJSON(),
|
mtime: stat.mtime.toJSON(),
|
||||||
|
|
|
@ -14,16 +14,15 @@ export default async function serveStatic (req, res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = withLeadingSlash(withoutTrailingSlash(parseURL(req.url).pathname))
|
let id = decodeURIComponent(withLeadingSlash(withoutTrailingSlash(parseURL(req.url).pathname)))
|
||||||
let asset = getAsset(id)
|
let asset: string
|
||||||
|
|
||||||
// Try index.html
|
for (const _id of [id, id + '/index.html']) {
|
||||||
if (!asset) {
|
|
||||||
const _id = id + '/index.html'
|
|
||||||
const _asset = getAsset(_id)
|
const _asset = getAsset(_id)
|
||||||
if (_asset) {
|
if (_asset) {
|
||||||
asset = _asset
|
asset = _asset
|
||||||
id = _id
|
id = _id
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue