fix(docker): defensive digest check

This commit is contained in:
Rhys Arkins 2021-04-05 09:15:57 +02:00
parent b80e7035c5
commit 325447e7da

View file

@ -351,7 +351,10 @@ async function getConfigDigest(
return null;
}
if (manifest.mediaType === MediaType.manifestListV2) {
if (
manifest.mediaType === MediaType.manifestListV2 &&
manifest.manifests.length
) {
logger.trace(
{ registry, dockerRepository, tag },
'Found manifest list, using first image'
@ -364,7 +367,7 @@ async function getConfigDigest(
}
if (manifest.mediaType === MediaType.manifestV2) {
return manifest.config.digest;
return manifest.config?.digest || null;
}
logger.debug({ manifest }, 'Invalid manifest - returning');