mirror of
https://github.com/containers/podman.git
synced 2025-06-19 00:06:43 +08:00
Don't use imageParts.assemble when pulling from a qualified name
CHANGES BEHAVIOR. If the name is qualified, instead of decomposing it into components and re-assembling, just use the input name unmodified: - For name:tag values, .assemble() just recreates the input. - For untagged values, .assemble() adds ":latest"; we keep the input as is, but both docker.ParseReference and storage.Transport.ParseStoreReference use reference.TagNameOnly() already. - For digested references, .assemble() adds ":none", but the code was already bypassing .assemble() on that path already - for the source reference. For the destination, this replaces a :none destination with a the @digest reference, as expected. Note that while decompose() has already parsed the input, it (intentionally) bypassed the docker.io/library normalization; therefore we parse the input again (via docker.ParseReference) to ensure that the reference is normalized. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@ -284,24 +284,13 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG
|
||||
return nil, err
|
||||
}
|
||||
if decomposedImage.hasRegistry {
|
||||
var imageName, destName string
|
||||
if hasShaInInputName(inputName) {
|
||||
imageName = inputName
|
||||
} else {
|
||||
imageName = decomposedImage.assemble()
|
||||
}
|
||||
srcRef, err := docker.ParseReference("//" + imageName)
|
||||
srcRef, err := docker.ParseReference("//" + inputName)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unable to parse '%s'", inputName)
|
||||
}
|
||||
if hasShaInInputName(inputName) {
|
||||
destName = decomposedImage.assemble()
|
||||
} else {
|
||||
destName = inputName
|
||||
}
|
||||
destRef, err := is.Transport.ParseStoreReference(ir.store, destName)
|
||||
destRef, err := is.Transport.ParseStoreReference(ir.store, inputName)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error parsing dest reference name %#v", destName)
|
||||
return nil, errors.Wrapf(err, "error parsing dest reference name %#v", inputName)
|
||||
}
|
||||
ps := pullRefPair{
|
||||
image: inputName,
|
||||
|
Reference in New Issue
Block a user