mirror of
https://github.com/goharbor/harbor
synced 2025-04-22 09:42:13 +00:00
Merge pull request #16605 from chlins/fix/project-creation-validation
fix: return BAD_REQUEST when validate project metadata
This commit is contained in:
commit
374ec5793e
@ -150,7 +150,7 @@ func (a *projectAPI) CreateProject(ctx context.Context, params operation.CreateP
|
|||||||
// validate metadata.public value, should only be "true" or "false"
|
// validate metadata.public value, should only be "true" or "false"
|
||||||
if p := req.Metadata.Public; p != "" {
|
if p := req.Metadata.Public; p != "" {
|
||||||
if p != "true" && p != "false" {
|
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)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user