Skip to content

Commit

Permalink
fix: avoid exceptions and display date when using OCI images (#372)
Browse files Browse the repository at this point in the history
fixes #372
  • Loading branch information
Joxit committed Sep 13, 2024
1 parent a36e3aa commit 079f359
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/scripts/docker-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class DockerImage {
}
self.ociImage = response.mediaType === 'application/vnd.oci.image.index.v1+json';
self.layers = response.layers || response.manifests;
self.annotations = response.annotations;
self.size = self.layers.reduce(function (acc, e) {
return acc + e.size;
}, 0);
Expand Down Expand Up @@ -160,8 +161,9 @@ export class DockerImage {
oReq.addEventListener('loadend', function () {
if (this.status === 200 || this.status === 202) {
const response = JSON.parse(this.responseText);
self.creationDate = new Date(response.created);
self.creationDate = new Date(response.created || self.annotations?.['org.opencontainers.image.created']);
self.blobs = response;
self.blobs.history = self.blobs.history || [];
self.blobs.history
.filter(function (e) {
return !e.empty_layer;
Expand Down

0 comments on commit 079f359

Please sign in to comment.