Retrieve the backupPath from the storage provider itself

This commit is contained in:
Johannes Zellner
2020-06-05 13:27:18 +02:00
parent 7ba3412aae
commit 330b4a613c
7 changed files with 53 additions and 2 deletions
+5 -2
View File
@@ -215,16 +215,19 @@ function get(backupId, callback) {
});
}
// This is not part of the storage api, since we don't want to pull the "format" logistics into that
function getBackupFilePath(backupConfig, backupId, format) {
assert.strictEqual(typeof backupConfig, 'object');
assert.strictEqual(typeof backupId, 'string');
assert.strictEqual(typeof format, 'string');
const backupPath = api(backupConfig.provider).getBackupPath(backupConfig);
if (format === 'tgz') {
const fileType = backupConfig.encryption ? '.tar.gz.enc' : '.tar.gz';
return path.join(backupConfig.prefix || backupConfig.backupFolder || '', backupId+fileType);
return path.join(backupPath, backupId+fileType);
} else {
return path.join(backupConfig.prefix || backupConfig.backupFolder || '', backupId);
return path.join(backupPath, backupId);
}
}