MCPcopy Create free account
hub / github.com/agegr/pi-web / isWithinPath

Function isWithinPath

lib/git-changes.ts:38–41  ·  view source on GitHub ↗
(parent: string, target: string)

Source from the content-addressed store, hash-verified

36}
37
38function isWithinPath(parent: string, target: string): boolean {
39 const relative = path.relative(path.resolve(parent), path.resolve(target));
40 return relative === "" || (!relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative));
41}
42
43function toGitPath(filePath: string): string {
44 return filePath.split(path.sep).join("/");

Callers 2

getGitStatusFunction · 0.85
getGitFileDiffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected