MCPcopy
hub / github.com/vitejs/vite / isFileInTargetPath

Function isFileInTargetPath

packages/vite/src/node/server/middlewares/static.ts:279–287  ·  view source on GitHub ↗
(
  targetPath: string,
  filePath: string,
)

Source from the content-addressed store, hash-verified

277 * @param filePath - normalized absolute path
278 */
279export function isFileInTargetPath(
280 targetPath: string,
281 filePath: string,
282): boolean {
283 return (
284 isSameFilePath(targetPath, filePath) ||
285 isParentDirectory(targetPath, filePath)
286 )
287}
288
289const windowsDriveRE = /^[A-Z]:/i
290

Callers 2

static.spec.tsFile · 0.90
isFileLoadingAllowedFunction · 0.85

Calls 2

isSameFilePathFunction · 0.90
isParentDirectoryFunction · 0.90

Tested by

no test coverage detected