restore: only take non-empty backupId
This commit is contained in:
+4
-4
@@ -1391,9 +1391,9 @@ function repair(appId, data, auditSource, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function restore(appId, data, auditSource, callback) {
|
||||
function restore(appId, backupId, auditSource, callback) {
|
||||
assert.strictEqual(typeof appId, 'string');
|
||||
assert.strictEqual(typeof data, 'object');
|
||||
assert.strictEqual(typeof backupId, 'string');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
@@ -1406,7 +1406,7 @@ function restore(appId, data, auditSource, callback) {
|
||||
if (error) return callback(error);
|
||||
|
||||
// for empty or null backupId, use existing manifest to mimic a reinstall
|
||||
var func = data.backupId ? backups.get.bind(null, data.backupId) : function (next) { return next(null, { manifest: app.manifest }); };
|
||||
var func = backupId ? backups.get.bind(null, backupId) : function (next) { return next(null, { manifest: app.manifest }); };
|
||||
|
||||
func(function (error, backupInfo) {
|
||||
if (error) return callback(error);
|
||||
@@ -1417,7 +1417,7 @@ function restore(appId, data, auditSource, callback) {
|
||||
error = checkManifestConstraints(backupInfo.manifest);
|
||||
if (error) return callback(error);
|
||||
|
||||
const restoreConfig = { backupId: data.backupId, backupFormat: backupInfo.format, oldManifest: app.manifest };
|
||||
const restoreConfig = { backupId, backupFormat: backupInfo.format, oldManifest: app.manifest };
|
||||
|
||||
const task = {
|
||||
args: {
|
||||
|
||||
Reference in New Issue
Block a user