backups: encrypted backups must have .enc extension

This commit is contained in:
Girish Ramakrishnan
2023-07-24 22:25:06 +05:30
parent febac9e8ca
commit 3d5c21d9ca
7 changed files with 28 additions and 42 deletions

View File

@@ -31,7 +31,6 @@ const assert = require('assert'),
BoxError = require('../boxerror.js'),
constants = require('../constants.js'),
debug = require('debug')('box:storage/gcs'),
PassThrough = require('stream').PassThrough,
path = require('path'),
safe = require('safetydance'),
util = require('util');
@@ -136,29 +135,14 @@ async function exists(apiConfig, backupFilePath) {
}
}
function download(apiConfig, backupFilePath, callback) {
async function download(apiConfig, backupFilePath) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof backupFilePath, 'string');
assert.strictEqual(typeof callback, 'function');
debug(`Download ${backupFilePath} starting`);
var file = getBucket(apiConfig).file(backupFilePath);
var ps = new PassThrough();
var readStream = file.createReadStream()
.on('error', function(error) {
if (error && error.code == 404){
ps.emit('error', new BoxError(BoxError.NOT_FOUND));
} else {
debug(`download: [${backupFilePath}] gcp stream error. %o`, error);
ps.emit('error', new BoxError(BoxError.EXTERNAL_ERROR, error));
}
})
;
readStream.pipe(ps);
callback(null, ps);
const file = getBucket(apiConfig).file(backupFilePath);
return file.createReadStream();
}
function listDir(apiConfig, backupFilePath, batchSize, iteratorCallback, callback) {