mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
fix(ui): fix image details view (#2470)
when a UI client tries to view image details for an image with multiple tags pointing to the same digest we make a query to dynamodb having duplicate keys (same digest) resulting in an error and the client is redirect back to image overview. closes: #2464 Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
parent
56f41dcc15
commit
e023936e8e
2 changed files with 16 additions and 1 deletions
|
@ -1439,7 +1439,11 @@ func expandedRepoInfo(ctx context.Context, repo string, metaDB mTypes.MetaDB, cv
|
|||
continue
|
||||
}
|
||||
|
||||
tagsDigests = append(tagsDigests, repoMeta.Tags[i].Digest)
|
||||
digest := repoMeta.Tags[i].Digest
|
||||
|
||||
if !zcommon.Contains(tagsDigests, digest) {
|
||||
tagsDigests = append(tagsDigests, digest)
|
||||
}
|
||||
}
|
||||
|
||||
imageMetaMap, err := metaDB.FilterImageMeta(ctx, tagsDigests)
|
||||
|
|
|
@ -236,6 +236,16 @@ func TestWrapperErrors(t *testing.T) {
|
|||
})
|
||||
})
|
||||
Convey("FilterImageMeta", func() {
|
||||
Convey("FilterImageMeta with duplicate digests", func() {
|
||||
image := CreateRandomImage()
|
||||
|
||||
err := dynamoWrapper.SetRepoReference(ctx, "repo", "tag", image.AsImageMeta())
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
_, err = dynamoWrapper.FilterImageMeta(ctx, []string{image.DigestStr(), image.DigestStr()})
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("manifest meta unmarshal error", func() {
|
||||
err = setImageMeta(image.Digest(), badProtoBlob, dynamoWrapper) //nolint: contextcheck
|
||||
So(err, ShouldBeNil)
|
||||
|
@ -243,6 +253,7 @@ func TestWrapperErrors(t *testing.T) {
|
|||
_, err = dynamoWrapper.FilterImageMeta(ctx, []string{image.DigestStr()})
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("MediaType ImageIndex, getProtoImageMeta fails", func() {
|
||||
err := dynamoWrapper.SetImageMeta(multiarchImageMeta.Digest, multiarchImageMeta) //nolint: contextcheck
|
||||
So(err, ShouldBeNil)
|
||||
|
|
Loading…
Reference in a new issue