From 308cc40cdeeef434c1050814f60c5944c13b4682 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Fri, 13 Aug 2021 11:22:33 +0200 Subject: [PATCH] fix: handle case when a repository does not exists --- src/routes/repository-public.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/repository-public.ts b/src/routes/repository-public.ts index 9a161e0..17f5d5f 100644 --- a/src/routes/repository-public.ts +++ b/src/routes/repository-public.ts @@ -18,7 +18,7 @@ router.get( res.attachment(`${repo.repoId}.zip`); // ache the file for 6 hours - res.header('Cache-Control', 'max-age=21600000'); + res.header("Cache-Control", "max-age=21600000"); repo.zip().pipe(res); } catch (error) { @@ -34,7 +34,7 @@ router.get( if (!repo) return; try { // ache the file for 6 hours - res.header('Cache-Control', 'max-age=21600000'); + res.header("Cache-Control", "max-age=21600000"); res.json(await repo.anonymizedFiles({ includeSha: false })); } catch (error) { @@ -48,7 +48,7 @@ router.get( async (req: express.Request, res: express.Response) => { try { const repo = await getRepo(req, res, { nocheck: true }); - + if (!repo) throw new Error("repo_not_found"); let redirectURL = null; if ( repo.status == "expired" &&