backups: encrypted backups must have .enc extension
This commit is contained in:
19
src/apps.js
19
src/apps.js
@@ -176,6 +176,7 @@ const appstore = require('./appstore.js'),
|
||||
os = require('os'),
|
||||
path = require('path'),
|
||||
paths = require('./paths.js'),
|
||||
PassThrough = require('stream').PassThrough,
|
||||
reverseProxy = require('./reverseproxy.js'),
|
||||
safe = require('safetydance'),
|
||||
semver = require('semver'),
|
||||
@@ -2669,12 +2670,20 @@ async function getBackupDownloadStream(app, backupId) {
|
||||
|
||||
const backupConfig = await settings.getBackupConfig();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
storage.api(backupConfig.provider).download(backupConfig, tgz.getBackupFilePath(backupConfig, backup.remotePath), function (error, sourceStream) {
|
||||
if (error) return reject(error);
|
||||
resolve(sourceStream);
|
||||
});
|
||||
const ps = new PassThrough();
|
||||
|
||||
const stream = await storage.api(backupConfig.provider).download(backupConfig, tgz.getBackupFilePath(backupConfig, backup.remotePath));
|
||||
stream.on('error', function(error) {
|
||||
debug(`getBackupDownloadStream: read stream error: ${error.message}`);
|
||||
ps.emit('error', new BoxError(BoxError.EXTERNAL_ERROR, error));
|
||||
});
|
||||
stream.pipe(ps);
|
||||
|
||||
const now = (new Date()).toISOString().replace(/:|T/g,'-').replace(/\..*/,'');
|
||||
const encryptionSuffix = backup.encryptionVersion ? '.enc' : '';
|
||||
const filename = `app-backup-${now} (${app.fqdn}).tar.gz${encryptionSuffix}`;
|
||||
|
||||
return { stream: ps, filename };
|
||||
}
|
||||
|
||||
async function restoreInstalledApps(options, auditSource) {
|
||||
|
||||
Reference in New Issue
Block a user