Skip to content

Commit

Permalink
Merge pull request #3623 from uselagoon/no-project-name
Browse files Browse the repository at this point in the history
fix: project name must not be empty
  • Loading branch information
tobybellwood authored Dec 14, 2023
2 parents e72152e + 2d34fe2 commit 18b3b82
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/api/src/resources/project/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
Expand Down Expand Up @@ -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!'
Expand Down

0 comments on commit 18b3b82

Please sign in to comment.