Skip to content

Commit

Permalink
fix: stop considering parent URLs as public file (#11145)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout authored Dec 23, 2022
1 parent b9511f1 commit 568a014
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vite/src/node/plugins/asset.ts
Original file line number Diff line number Diff line change
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 568a014

Please sign in to comment.