aboutsummaryrefslogtreecommitdiff
path: root/packages/server
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-06-21 15:44:22 +0200
committerHampusM <hampus@hampusmat.com>2021-06-21 15:44:22 +0200
commit09cb1639654ce9f181ee32d7180b88bbbaabf843 (patch)
treeb4f5460bda1e7fd138c67eb5f0b51dc55fcfd56e /packages/server
parent647a916b251f0b1af1a59874fabb4cf8ebb245d9 (diff)
The branch endpoint verifies the branch SHA
Diffstat (limited to 'packages/server')
-rw-r--r--packages/server/src/api/v1.ts5
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) {