Merge pull request #16605 from chlins/fix/project-creation-validation

fix: return BAD_REQUEST when validate project metadata
This commit is contained in:
Chenyu Zhang 2022-03-30 09:55:19 +08:00 committed by GitHub
commit 374ec5793e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -150,7 +150,7 @@ func (a *projectAPI) CreateProject(ctx context.Context, params operation.CreateP
// validate metadata.public value, should only be "true" or "false"
if p := req.Metadata.Public; p != "" {
if p != "true" && p != "false" {
return a.SendError(ctx, errors.Errorf("metadata.public should only be 'true' or 'false', but got: '%s'", p))
return a.SendError(ctx, errors.BadRequestError(nil).WithMessage(fmt.Sprintf("metadata.public should only be 'true' or 'false', but got: '%s'", p)))
}
}