From 5fb2264a9b3fd66e2d2a51fa09f38003814234f6 Mon Sep 17 00:00:00 2001 From: Max Edell Date: Tue, 16 Jul 2024 07:46:21 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Tobias Bocanegra --- packages/helix-shared-storage/src/storage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/helix-shared-storage/src/storage.js b/packages/helix-shared-storage/src/storage.js index 1ded38e6..d98da716 100644 --- a/packages/helix-shared-storage/src/storage.js +++ b/packages/helix-shared-storage/src/storage.js @@ -312,7 +312,7 @@ class Bucket { try { if (opts.addMetadata) { - const meta = await this.metadata(key); + const meta = await this.metadata(key) ?? {}; input.Metadata = { ...meta, ...opts.addMetadata }; input.MetadataDirective = 'REPLACE'; } @@ -465,7 +465,7 @@ class Bucket { }; try { if (opts.addMetadata) { - const meta = await this.metadata(task.src); + const meta = await this.metadata(task.src) || {}; input.Metadata = { ...meta, ...opts.addMetadata }; input.MetadataDirective = 'REPLACE'; }