From 09cb1639654ce9f181ee32d7180b88bbbaabf843 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 21 Jun 2021 15:44:22 +0200 Subject: The branch endpoint verifies the branch SHA --- packages/server/src/api/v1.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'packages/server/src/api/v1.ts') diff --git a/packages/server/src/api/v1.ts b/packages/server/src/api/v1.ts index 216d33d..b0e595d 100644 --- a/packages/server/src/api/v1.ts +++ b/packages/server/src/api/v1.ts @@ -121,6 +121,11 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do url: "/branches/:branch", handler: async(req, reply) => { const params: any = req.params; + const branch_verification = await verifySHA(git, params.repo, params.branch); + if(branch_verification.success === false && branch_verification.code) { + reply.code(branch_verification.code).send({ error: branch_verification.message }); + } + const branch = await git.getBranch(params.repo, params.branch); if(!branch) { -- cgit v1.2.3-18-g5258