fix: catch error when requesting a folder

This commit is contained in:
tdurieux committed 2024-05-03 10:49:25 +02:00
1 parent ca04339529
commit 93606a5c39
3 files changed
+7 -18

No files matched your search

+5 -5
View File
@@ -25,12 +25,12 @@ router.post("/", async (req: express.Request, res: express.Response) => {
commit: commit,
getToken: () => token,
});
const content = await source.getFileContentCache(
filePath,
repoId,
() => fileSha
);
try {
const content = await source.getFileContentCache(
filePath,
repoId,
() => fileSha
);
const mime = lookup(filePath);
if (mime && !filePath.endsWith(".ts")) {
res.contentType(mime);