mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-15 23:05:57 +01:00
fix: validate project metadata public value
Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
parent
44ae875e33
commit
3eaa62726e
@ -147,6 +147,13 @@ func (a *projectAPI) CreateProject(ctx context.Context, params operation.CreateP
|
||||
req.Metadata.Public = strconv.FormatBool(false)
|
||||
}
|
||||
|
||||
// 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.BadRequestError(nil).WithMessage(fmt.Sprintf("metadata.public should only be 'true' or 'false', but got: '%s'", p)))
|
||||
}
|
||||
}
|
||||
|
||||
// ignore enable_content_trust metadata for proxy cache project
|
||||
// see https://github.com/goharbor/harbor/issues/12940 to get more info
|
||||
if req.RegistryID != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user