From 647a916b251f0b1af1a59874fabb4cf8ebb245d9 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 21 Jun 2021 15:40:20 +0200 Subject: Improved backend error handling --- packages/server/src/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/server/src/app.ts') diff --git a/packages/server/src/app.ts b/packages/server/src/app.ts index 263703b..3cb1c07 100644 --- a/packages/server/src/app.ts +++ b/packages/server/src/app.ts @@ -81,7 +81,7 @@ fastify.route({ reply.header("Content-Type", "application/x-git-upload-pack-advertisement"); const repo_verification = await verifyRepoName(settings.base_dir, (req).params.repo); - if(repo_verification.success === false) { + if(repo_verification.success === false && repo_verification.code) { reply.code(repo_verification.code).send(repo_verification.message); } @@ -108,7 +108,7 @@ fastify.route({ url: "/:repo([a-zA-Z0-9\\.\\-_]+)/git-upload-pack", handler: async(req, reply) => { const repo_verification = await verifyRepoName(settings.base_dir, (req).params.repo); - if(repo_verification.success === false) { + if(repo_verification.success === false && repo_verification.code) { reply.header("Content-Type", "application/x-git-upload-pack-result"); reply.code(repo_verification.code).send(repo_verification.message); } -- cgit v1.2.3-18-g5258