diff --git a/lib/api/apiUtils/object/abortMultipartUpload.js b/lib/api/apiUtils/object/abortMultipartUpload.js index 633c726e72..97eda8ff4e 100644 --- a/lib/api/apiUtils/object/abortMultipartUpload.js +++ b/lib/api/apiUtils/object/abortMultipartUpload.js @@ -104,7 +104,7 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log, bucketName, objectKey, uploadId, - versionId: objectMD.versionId + versionId: objectMD.versionId, }); return metadata.deleteObjectMD(bucketName, objectKey, { versionId: objectMD.versionId }, log, err => { if (err) { @@ -120,16 +120,15 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log, } // The locations were sent to metadata as an array // under partLocations. Pull the partLocations. - let locations = storedParts.flatMap(item => item.value.partLocations); + const locations = storedParts.flatMap(item => item.value.partLocations); if (locations.length === 0) { return next(null, mpuBucket, storedParts, destBucket); } - const existingLocations = new Set(locations.map(loc => loc.key)); - if (objectMD?.location) { + const existingLocations = new Set(locations.map(loc => loc.key)); const remainingObjectLocations = objectMD.location.filter(loc => !existingLocations.has(loc.key)); - locations = [...locations, ...remainingObjectLocations]; + locations.push(...remainingObjectLocations); } return async.eachLimit(locations, 5, (loc, cb) => {