mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-10 07:28:36 +02:00
fix: handle case when a repository does not exists
This commit is contained in:
@@ -18,7 +18,7 @@ router.get(
|
|||||||
res.attachment(`${repo.repoId}.zip`);
|
res.attachment(`${repo.repoId}.zip`);
|
||||||
|
|
||||||
// ache the file for 6 hours
|
// ache the file for 6 hours
|
||||||
res.header('Cache-Control', 'max-age=21600000');
|
res.header("Cache-Control", "max-age=21600000");
|
||||||
|
|
||||||
repo.zip().pipe(res);
|
repo.zip().pipe(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -34,7 +34,7 @@ router.get(
|
|||||||
if (!repo) return;
|
if (!repo) return;
|
||||||
try {
|
try {
|
||||||
// ache the file for 6 hours
|
// 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 }));
|
res.json(await repo.anonymizedFiles({ includeSha: false }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -48,7 +48,7 @@ router.get(
|
|||||||
async (req: express.Request, res: express.Response) => {
|
async (req: express.Request, res: express.Response) => {
|
||||||
try {
|
try {
|
||||||
const repo = await getRepo(req, res, { nocheck: true });
|
const repo = await getRepo(req, res, { nocheck: true });
|
||||||
|
if (!repo) throw new Error("repo_not_found");
|
||||||
let redirectURL = null;
|
let redirectURL = null;
|
||||||
if (
|
if (
|
||||||
repo.status == "expired" &&
|
repo.status == "expired" &&
|
||||||
|
|||||||
Reference in New Issue
Block a user