feat: flatten file tree for better performance

This commit is contained in:
tdurieux
2024-04-26 10:32:09 +01:00
parent ccdc95e4a8
commit 710f7328e7
23 changed files with 516 additions and 514 deletions
+8 -3
View File
@@ -63,10 +63,16 @@ router.get(
"/:repoId/files",
async (req: express.Request, res: express.Response) => {
res.header("Cache-Control", "no-cache");
const repo = await getRepo(req, res, { includeFiles: true });
const repo = await getRepo(req, res);
if (!repo) return;
try {
res.json(await repo.anonymizedFiles({ includeSha: false }));
res.json(
await repo.anonymizedFiles({
includeSha: false,
recursive: false,
path: req.query.path as string,
})
);
} catch (error) {
handleError(error, res, req);
}
@@ -80,7 +86,6 @@ router.get(
res.header("Cache-Control", "no-cache");
const repo = await getRepo(req, res, {
nocheck: true,
includeFiles: false,
});
if (!repo) return;
let redirectURL = null;