mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
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 stat = statSync(fullPath)
|
||||
|
||||
assets['/' + id] = {
|
||||
assets['/' + decodeURIComponent(id)] = {
|
||||
type,
|
||||
etag,
|
||||
mtime: stat.mtime.toJSON(),
|
||||
|
@ -14,16 +14,15 @@ export default async function serveStatic (req, res) {
|
||||
return
|
||||
}
|
||||
|
||||
let id = withLeadingSlash(withoutTrailingSlash(parseURL(req.url).pathname))
|
||||
let asset = getAsset(id)
|
||||
let id = decodeURIComponent(withLeadingSlash(withoutTrailingSlash(parseURL(req.url).pathname)))
|
||||
let asset: string
|
||||
|
||||
// Try index.html
|
||||
if (!asset) {
|
||||
const _id = id + '/index.html'
|
||||
for (const _id of [id, id + '/index.html']) {
|
||||
const _asset = getAsset(_id)
|
||||
if (_asset) {
|
||||
asset = _asset
|
||||
id = _id
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user