MCPcopy Create free account
hub / github.com/Snapchat/Valdi / isPathAllowed

Function isPathAllowed

npm_modules/cli/src/utils/fileUtils.ts:216–228  ·  view source on GitHub ↗
(filePath: string, blacklist: RegExp[], whitelist: RegExp[])

Source from the content-addressed store, hash-verified

214}
215
216function isPathAllowed(filePath: string, blacklist: RegExp[], whitelist: RegExp[]): boolean {
217 const normalizedPath = resolveFilePath(filePath);
218
219 if (blacklist.length > 0 && matchesCompiledPatterns(blacklist, normalizedPath)) {
220 return false;
221 }
222
223 if (whitelist.length > 0) {
224 return matchesCompiledPatterns(whitelist, normalizedPath);
225 }
226
227 return true;
228}
229
230export function copyFiles(sourceDir: string, destDir: string, config: CopyConfig = {}) {
231 // Precompile patterns for efficiency.

Callers 1

copyFilesFunction · 0.85

Calls 2

resolveFilePathFunction · 0.85
matchesCompiledPatternsFunction · 0.85

Tested by

no test coverage detected