Fix bug of listing tags filtered by label

Fixes #8249

Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
Wenkai Yin 2019-08-19 16:10:16 +08:00
parent b15c6bcdc7
commit a5d292c9c6

View File

@ -584,7 +584,12 @@ func (ra *RepositoryAPI) GetTags() {
} }
labeledTags := map[string]struct{}{} labeledTags := map[string]struct{}{}
for _, rl := range rls { for _, rl := range rls {
labeledTags[strings.Split(rl.ResourceName, ":")[1]] = struct{}{} strs := strings.SplitN(rl.ResourceName, ":", 2)
// the "rls" may contain images which don't belong to the repository
if strs[0] != repoName {
continue
}
labeledTags[strs[1]] = struct{}{}
} }
ts := []string{} ts := []string{}
for _, tag := range tags { for _, tag := range tags {