Skip to content

Commit

Permalink
fix: stop considering parent URLs as public file (vitejs#11145)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout authored and futurGH committed Feb 26, 2023
1 parent 970f5c0 commit 69dd986
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vite/src/node/plugins/asset.ts
Expand Up @@ -210,6 +210,10 @@ export function checkPublicFile(
return
}
const publicFile = path.join(publicDir, cleanUrl(url))
if (!publicFile.startsWith(publicDir)) {
// can happen if URL starts with '../'
return
}
if (fs.existsSync(publicFile)) {
return publicFile
} else {
Expand Down

0 comments on commit 69dd986

Please sign in to comment.