Skip to content

Commit 079f359

Browse files
committed
fix: avoid exceptions and display date when using OCI images (#372)
fixes #372
1 parent a36e3aa commit 079f359

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/scripts/docker-image.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export class DockerImage {
113113
}
114114
self.ociImage = response.mediaType === 'application/vnd.oci.image.index.v1+json';
115115
self.layers = response.layers || response.manifests;
116+
self.annotations = response.annotations;
116117
self.size = self.layers.reduce(function (acc, e) {
117118
return acc + e.size;
118119
}, 0);
@@ -160,8 +161,9 @@ export class DockerImage {
160161
oReq.addEventListener('loadend', function () {
161162
if (this.status === 200 || this.status === 202) {
162163
const response = JSON.parse(this.responseText);
163-
self.creationDate = new Date(response.created);
164+
self.creationDate = new Date(response.created || self.annotations?.['org.opencontainers.image.created']);
164165
self.blobs = response;
166+
self.blobs.history = self.blobs.history || [];
165167
self.blobs.history
166168
.filter(function (e) {
167169
return !e.empty_layer;

0 commit comments

Comments
 (0)