Skip to content

Commit

Permalink
fix: avoid DOM Clobbering gadget in getRelativeUrlFromDocument (#18115
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jackfromeast authored and patak-dev committed Sep 16, 2024
1 parent 8339d74 commit ebb94c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ const getRelativeUrlFromDocument = (relativePath: string, umd = false) =>
getResolveUrl(
`'${escapeId(partialEncodeURIPath(relativePath))}', ${
umd ? `typeof document === 'undefined' ? location.href : ` : ''
}document.currentScript && document.currentScript.src || document.baseURI`,
}document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || document.baseURI`,
)

const getFileUrlFromFullPath = (path: string) =>
Expand Down

0 comments on commit ebb94c5

Please sign in to comment.