From 7ec5595bd873c622ebdd715c80c6dcea14db8d95 Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Mon, 30 Mar 2020 10:10:12 +0800 Subject: [PATCH] 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 --- src/replication/filter/artifact.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/replication/filter/artifact.go b/src/replication/filter/artifact.go index cc88279c8..dc317dc9a 100644 --- a/src/replication/filter/artifact.go +++ b/src/replication/filter/artifact.go @@ -155,6 +155,19 @@ func (a *artifactTagFilter) Filter(artifacts []*model.Artifact) ([]*model.Artifa } var result []*model.Artifact 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 for _, tag := range artifact.Tags { match, err := util.Match(a.pattern, tag)