scope file search to current directory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 00:58:10 +00:00
co-authored by Claude Opus 4.6
parent c66bbfa379
commit c7d509b725
3 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -843,6 +843,8 @@ router.get('/search', async (ctx) => {
const rootDir = getRootDir(user, ctx.req.query('root') ?? undefined);
const query = (ctx.req.query('q') || '').trim().toLowerCase();
if (!query) throw errors.BAD_REQUEST('q is required');
const searchPath = ctx.req.query('path') || '';
const startDir = searchPath ? resolveUserPath(rootDir, searchPath) : rootDir;
const MAX_RESULTS = 50;
const results: { path: string; name: string; type: string; size: number; modifiedAt: number }[] = [];
@@ -870,7 +872,7 @@ router.get('/search', async (ctx) => {
}
}
await walk(rootDir);
await walk(startDir);
return ctx.json({ results });
});