From 2d34fe2351df9dbdc9c64f6a4fc8967145843a0f Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Thu, 14 Dec 2023 10:17:00 +1100 Subject: [PATCH] fix: project name must not be empty --- services/api/src/resources/project/resolvers.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/api/src/resources/project/resolvers.ts b/services/api/src/resources/project/resolvers.ts index b55896c6fb..d2af5630e7 100644 --- a/services/api/src/resources/project/resolvers.ts +++ b/services/api/src/resources/project/resolvers.ts @@ -284,6 +284,11 @@ export const addProject = async ( } } + if (input.name.trim().length == 0) { + throw new Error( + 'A project name must be provided!' + ); + } if (validator.matches(input.name, /[^0-9a-z-]/)) { throw new Error( 'Only lowercase characters, numbers and dashes allowed for name!' @@ -680,6 +685,11 @@ export const updateProject: ResolverFn = async ( } if (typeof name === 'string') { + if (name.trim().length == 0) { + throw new Error( + 'A project name must be provided!' + ); + } if (validator.matches(name, /[^0-9a-z-]/)) { throw new Error( 'Only lowercase characters, numbers and dashes allowed for name!'