From d53eef1061720364d33e7a0c381a41a7b43a7408 Mon Sep 17 00:00:00 2001 From: gerwoud Date: Mon, 11 Mar 2024 21:39:34 +0100 Subject: [PATCH] fix handling fail --- backend/project/endpoints/projects/projects.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/project/endpoints/projects/projects.py b/backend/project/endpoints/projects/projects.py index 39815429..bfa65a0e 100644 --- a/backend/project/endpoints/projects/projects.py +++ b/backend/project/endpoints/projects/projects.py @@ -50,7 +50,7 @@ def post(self): # save the file that is given with the request - new_project, _ = create_model_instance( + new_project, status_code = create_model_instance( Project, project_json, urljoin(f"{API_URL}/", "/projects"), @@ -62,6 +62,9 @@ def post(self): "archieved"] ) + if status_code == 400: + return new_project, status_code + project_upload_directory = os.path.join(f"{UPLOAD_FOLDER}", f"{new_project.project_id}") os.makedirs(project_upload_directory, exist_ok=True)