Add backup download route if backend supports it
This commit is contained in:
+12
-1
@@ -3,7 +3,8 @@
|
||||
exports = module.exports = {
|
||||
get: get,
|
||||
create: create,
|
||||
createDownloadUrl: createDownloadUrl
|
||||
createDownloadUrl: createDownloadUrl,
|
||||
download: download
|
||||
};
|
||||
|
||||
var assert = require('assert'),
|
||||
@@ -52,3 +53,13 @@ function createDownloadUrl(req, res, next) {
|
||||
next(new HttpSuccess(200, result));
|
||||
});
|
||||
}
|
||||
|
||||
function download(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.backupId, 'string');
|
||||
|
||||
backups.getLocalDownloadPath(req.params.backupId, function (error, result) {
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
res.sendFile(result);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user