backups: add remotePath
the main motivation is that id can be used in REST API routes. previously, the id was a path and this had a "/" in it. This made /api/v1/backups/:backupId not work.
This commit is contained in:
@@ -38,17 +38,17 @@ function api(provider) {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
function getBackupFilePath(backupConfig, remotePath, format) {
|
||||
assert.strictEqual(typeof backupConfig, 'object');
|
||||
assert.strictEqual(typeof backupId, 'string');
|
||||
assert.strictEqual(typeof remotePath, 'string');
|
||||
assert.strictEqual(typeof format, 'string');
|
||||
|
||||
const basePath = api(backupConfig.provider).getBasePath(backupConfig);
|
||||
const rootPath = api(backupConfig.provider).getRootPath(backupConfig);
|
||||
|
||||
if (format === 'tgz') {
|
||||
const fileType = backupConfig.encryption ? '.tar.gz.enc' : '.tar.gz';
|
||||
return path.join(basePath, backupId+fileType);
|
||||
return path.join(rootPath, remotePath + fileType);
|
||||
} else {
|
||||
return path.join(basePath, backupId);
|
||||
return path.join(rootPath, remotePath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user