Skip to content

Commit

Permalink
storageImageDestination: only add a digested reference to named images
Browse files Browse the repository at this point in the history
When writing an image that has an instanceDigest value (meaning it's a
secondary image), don't try to generate a canonical reference to add to
the image's list of names if the reference for the primary image doesn't
contain a name.  That should only happen if we're writing using just an
image ID, which is unlikely, but we still need to handle it.

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Feb 1, 2018
1 parent 02412b9 commit ff09c34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storage/storage_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func (s *storageImageDestination) commitDataBlobs(imageID string) error {
func (s *storageImageDestination) commitName(imageID string, oldNames []string, instanceDigest *digest.Digest) error {
if name := s.imageRef.DockerReference(); len(oldNames) > 0 || name != nil {
var err error
if instanceDigest != nil {
if instanceDigest != nil && name != nil {
name, err = reference.WithDigest(reference.TrimNamed(name), *instanceDigest)
if err != nil {
return errors.Wrapf(err, "error computing name for image %q", imageID)
Expand Down

0 comments on commit ff09c34

Please sign in to comment.