fix(custom-labels): history fails on images with no labels

This commit is contained in:
Joxit 2022-04-03 00:02:15 +02:00
parent ba2e0b119e
commit f826381681
No known key found for this signature in database
GPG key ID: F526592B8E012263

View file

@ -180,7 +180,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
};
const getConfig = function (blobs, { historyCustomLabels }) {
console.log(this);
const res = [
'architecture',
'User',
@ -212,12 +211,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
delete res.Labels.maintainer;
}
historyCustomLabels
.filter((label) => res.Labels[label])
.forEach((label) => {
res[`custom-label-${label}`] = res.Labels[label];
delete res.Labels[label];
});
if (res.Labels) {
historyCustomLabels
.filter((label) => res.Labels[label])
.forEach((label) => {
res[`custom-label-${label}`] = res.Labels[label];
delete res.Labels[label];
});
}
return res;
};