Skip to content

Commit 24d04b4

Browse files
add defensive code around replicationInfo
Issue: S3UTILS-243
1 parent c761f9e commit 24d04b4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

utils/S3UtilsMongoClient.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
280280
targetCount = 'versionCount';
281281
targetData = 'versionData';
282282

283-
if (entry.value.replicationInfo.backends.length > 0
283+
if (entry.value.replicationInfo?.backends?.length > 0
284284
&& this._isReplicationEntryStalled(entry, cmpDate)) {
285285
stalledCount++;
286286
}
@@ -511,7 +511,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
511511
};
512512

513513
// only count it in current dataStore if object is not in transient or replication not completed
514-
if (!isTransient || entry.value.replicationInfo.status !== 'COMPLETED') {
514+
if (!isTransient || entry.value.replicationInfo?.status !== 'COMPLETED') {
515515
results.location[entry.value.dataStoreName] = size;
516516
// We do not support restores to custom location yet. If we do,
517517
// the destination would be present in the object metadata. For now,
@@ -523,7 +523,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
523523
results.location[bucketInfo.getLocationConstraint()] = size;
524524
}
525525
}
526-
entry.value.replicationInfo.backends.forEach(rep => {
526+
entry.value.replicationInfo?.backends?.forEach(rep => {
527527
// count it in the replication destination location if replication compeleted
528528
if (rep.status === 'COMPLETED') {
529529
results.location[rep.site] = size;

0 commit comments

Comments
 (0)