diff options
author | HampusM <hampus@hampusmat.com> | 2021-06-21 15:44:22 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-06-21 15:44:22 +0200 |
commit | 09cb1639654ce9f181ee32d7180b88bbbaabf843 (patch) | |
tree | b4f5460bda1e7fd138c67eb5f0b51dc55fcfd56e /packages | |
parent | 647a916b251f0b1af1a59874fabb4cf8ebb245d9 (diff) |
The branch endpoint verifies the branch SHA
Diffstat (limited to 'packages')
-rw-r--r-- | packages/server/src/api/v1.ts | 5 |
1 files changed, 5 insertions, 0 deletions
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) { |