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