Skip to content

Commit

Permalink
Merge pull request #2087 from aaronlehmann/missing-digest-panic
Browse files Browse the repository at this point in the history
schema1: Validate descriptors in AppendReference
  • Loading branch information
dmcgowan authored Nov 30, 2016
2 parents bf27f26 + ec5fa1f commit c599955
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions manifest/schema1/config_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,13 @@ func (mb *configManifestBuilder) emptyTar(ctx context.Context) (digest.Digest, e

// AppendReference adds a reference to the current ManifestBuilder
func (mb *configManifestBuilder) AppendReference(d distribution.Describable) error {
// todo: verification here?
mb.descriptors = append(mb.descriptors, d.Descriptor())
descriptor := d.Descriptor()

if err := descriptor.Digest.Validate(); err != nil {
return err
}

mb.descriptors = append(mb.descriptors, descriptor)
return nil
}

Expand Down

0 comments on commit c599955

Please sign in to comment.