mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-17 12:21:24 +01:00
Make sure the tag filter have the same behavior for empty value and *
Fixes #11233, make sure the tag filter have the same behavior for empty value and * Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
9a205ddbc3
commit
7ec5595bd8
@ -155,6 +155,19 @@ func (a *artifactTagFilter) Filter(artifacts []*model.Artifact) ([]*model.Artifa
|
|||||||
}
|
}
|
||||||
var result []*model.Artifact
|
var result []*model.Artifact
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
|
// untagged artifact
|
||||||
|
if len(artifact.Tags) == 0 {
|
||||||
|
match, err := util.Match(a.pattern, "")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if match {
|
||||||
|
result = append(result, artifact)
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// tagged artifact
|
||||||
var tags []string
|
var tags []string
|
||||||
for _, tag := range artifact.Tags {
|
for _, tag := range artifact.Tags {
|
||||||
match, err := util.Match(a.pattern, tag)
|
match, err := util.Match(a.pattern, tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user