Ensure we get a proper retention policy for backups

This commit is contained in:
Johannes Zellner
2020-05-28 16:26:11 +02:00
parent 38cc767f27
commit 7a3efa2631

View File

@@ -386,7 +386,12 @@ function getBackupConfig(callback) {
if (error && error.reason === BoxError.NOT_FOUND) return callback(null, gDefaults[exports.BACKUP_CONFIG_KEY]);
if (error) return callback(error);
callback(null, JSON.parse(value)); // provider, token, password, region, prefix, bucket
var tmp = JSON.parse(value);
// ensure we have a proper retention policy, the rest api checks for validity on settings at the moment
if (!tmp.retentionPolicy || Object.keys(tmp.retentionPolicy) === 0) tmp.retentionPolicy = gDefaults[exports.BACKUP_CONFIG_KEY].retentionPolicy;
callback(null, tmp); // provider, token, password, region, prefix, bucket
});
}