MCPcopy Index your code
hub / github.com/coder/mux / isPathWithinRoot

Function isPathWithinRoot

src/node/services/memoryService.ts:275–282  ·  view source on GitHub ↗
(
  realRoot: string,
  candidate: string,
  pathModule: path.PlatformPath
)

Source from the content-addressed store, hash-verified

273}
274
275function isPathWithinRoot(
276 realRoot: string,
277 candidate: string,
278 pathModule: path.PlatformPath
279): boolean {
280 const relative = pathModule.relative(realRoot, candidate);
281 return relative === "" || (!relative.startsWith("..") && !pathModule.isAbsolute(relative));
282}
283
284/**
285 * Stable project identity for memory scope contexts ("" disables project

Callers 1

assertContainedMethod · 0.85

Calls 2

relativeMethod · 0.80
isAbsoluteMethod · 0.80

Tested by

no test coverage detected