From a026e2c2bb94ab0227d5153b06d33217d864f8d6 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 2 May 2023 10:24:52 +0100 Subject: [PATCH] Fix release creation using API --- app/blueprints/api/endpoints.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/blueprints/api/endpoints.py b/app/blueprints/api/endpoints.py index 73ce8aeb..b83118b9 100644 --- a/app/blueprints/api/endpoints.py +++ b/app/blueprints/api/endpoints.py @@ -243,7 +243,11 @@ def create_release(token, package): if not package.checkPerm(token.owner, Permission.APPROVE_RELEASE): error(403, "You do not have the permission to approve releases") - data = request.json or request.form + if request.headers.get("Content-Type") == "application/json": + data = request.json + else: + data = request.form + if "title" not in data: error(400, "Title is required in the POST data")