This commit is contained in:
2025-11-11 14:19:03 -07:00
parent 7fec0424d7
commit 890e08d1b2
6 changed files with 46 additions and 16 deletions

View File

@@ -72,4 +72,15 @@ export const fileStorageService = {
}
return { files, folders };
},
async directoryExists(relativePath: string): Promise<boolean> {
const fullPath = path.join(basePath, relativePath);
// Security: ensure fullPath is inside basePath
const resolvedBase = path.resolve(basePath);
const resolvedFull = path.resolve(fullPath);
if (!resolvedFull.startsWith(resolvedBase)) {
return false;
}
return await directoryOrFileExists(fullPath);
},
};