minor variable rename
This commit is contained in:
13
src/apps.js
13
src/apps.js
@@ -2133,19 +2133,20 @@ async function restore(app, backupId, auditSource) {
|
||||
|
||||
// for empty or null backupId, use existing manifest to mimic a reinstall
|
||||
const backupInfo = backupId ? await backups.get(backupId) : { manifest: app.manifest };
|
||||
const manifest = backupInfo.manifest;
|
||||
|
||||
if (!backupInfo.manifest) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Could not get restore manifest');
|
||||
if (!manifest) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Could not get restore manifest');
|
||||
if (backupInfo.encryptionVersion === 1) throw new BoxError(BoxError.BAD_FIELD, 'This encrypted backup was created with an older Cloudron version and has to be restored using the CLI tool');
|
||||
|
||||
// re-validate because this new box version may not accept old configs
|
||||
error = checkManifestConstraints(backupInfo.manifest);
|
||||
error = checkManifestConstraints(manifest);
|
||||
if (error) throw error;
|
||||
|
||||
let values = { manifest: backupInfo.manifest };
|
||||
if (!backupInfo.manifest.addons?.sendmail) { // clear if restore removed addon
|
||||
const values = { manifest };
|
||||
if (!manifest.addons?.sendmail) { // clear if restore removed addon
|
||||
values.mailboxName = values.mailboxDomain = null;
|
||||
} else if (!app.mailboxName || app.mailboxName.endsWith('.app')) { // allocate since restore added the addon
|
||||
values.mailboxName = mailboxNameForSubdomain(app.subdomain, backupInfo.manifest);
|
||||
values.mailboxName = mailboxNameForSubdomain(app.subdomain, manifest);
|
||||
values.mailboxDomain = app.domain;
|
||||
}
|
||||
|
||||
@@ -2163,7 +2164,7 @@ async function restore(app, backupId, auditSource) {
|
||||
|
||||
const taskId = await addTask(appId, exports.ISTATE_PENDING_RESTORE, task, auditSource);
|
||||
|
||||
await eventlog.add(eventlog.ACTION_APP_RESTORE, auditSource, { app, backupId: backupInfo.id, remotePath: backupInfo.remotePath, fromManifest: app.manifest, toManifest: backupInfo.manifest, taskId });
|
||||
await eventlog.add(eventlog.ACTION_APP_RESTORE, auditSource, { app, backupId: backupInfo.id, remotePath: backupInfo.remotePath, fromManifest: app.manifest, toManifest: manifest, taskId });
|
||||
|
||||
return { taskId };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user