MCPcopy Create free account
hub / github.com/backnotprop/plannotator / isAllowedHtmlSharePath

Function isAllowedHtmlSharePath

packages/server/annotate.ts:199–207  ·  view source on GitHub ↗
(targetPath: string)

Source from the content-addressed store, hash-verified

197 }
198
199 function isAllowedHtmlSharePath(targetPath: string): boolean {
200 const roots = new Set<string>([process.cwd()]);
201 if (folderPath) roots.add(folderPath);
202 if (!/^https?:\/\//i.test(filePath)) roots.add(dirname(filePath));
203 for (const root of roots) {
204 if (isWithinDirectory(targetPath, root)) return true;
205 }
206 return false;
207 }
208
209 const singleFileSourceSaveEligible = mode === "annotate" && !sourceConverted && !(renderHtml && rawHtml) && !/^https?:\/\//i.test(filePath);
210 const initialSingleFileSourceSave = singleFileSourceSaveEligible

Callers 1

loadShareHtmlFunction · 0.70

Calls 3

isWithinDirectoryFunction · 0.90
dirnameFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected