mirror of
https://github.com/containers/skopeo.git
synced 2025-09-14 22:10:00 +00:00
Use reference.Tagged to extract the tag from a reference
... instead of manually parsing strings. Should not change behavior, except maybe error messages if the registry returns invalid tags. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
committed by
Valentin Rothberg
parent
35f3595d02
commit
16b435257b
@@ -359,8 +359,12 @@ func imagesToCopyFromRegistry(registryName string, cfg registrySyncConfig, sourc
|
|||||||
|
|
||||||
repoLogger.Infof("Start filtering using the regular expression: %v", tagRegex)
|
repoLogger.Infof("Start filtering using the regular expression: %v", tagRegex)
|
||||||
for _, sReference := range allSourceReferences {
|
for _, sReference := range allSourceReferences {
|
||||||
// get the tag names to match, [1] default is "latest" by .DockerReference().String()
|
tagged, isTagged := sReference.DockerReference().(reference.Tagged)
|
||||||
if tagReg.Match([]byte(strings.Split(sReference.DockerReference().String(), ":")[1])) {
|
if !isTagged {
|
||||||
|
repoLogger.Errorf("Internal error, reference %s does not have a tag, skipping", sReference.DockerReference())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if tagReg.Match([]byte(tagged.Tag())) {
|
||||||
sourceReferences = append(sourceReferences, sReference)
|
sourceReferences = append(sourceReferences, sReference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user