update: updateConfig can be missing values, selectively update db

This commit is contained in:
Girish Ramakrishnan
2024-07-17 08:58:43 +02:00
parent aeddaa4566
commit 01deb4d285
2 changed files with 5 additions and 8 deletions

View File

@@ -1995,11 +1995,7 @@ async function updateApp(app, data, auditSource) {
assert(data.manifest && typeof data.manifest === 'object');
assert.strictEqual(typeof auditSource, 'object');
const skipBackup = !!data.skipBackup,
appId = app.id,
manifest = data.manifest,
appStoreId = data.appStoreId;
const skipBackup = !!data.skipBackup, appId = app.id, manifest = data.manifest;
const values = {};
if (app.runState === exports.RSTATE_STOPPED) throw new BoxError(BoxError.BAD_STATE, 'Stopped apps cannot be updated');
@@ -2013,7 +2009,8 @@ async function updateApp(app, data, auditSource) {
error = await checkManifest(manifest);
if (error) throw error;
const updateConfig = { skipBackup, manifest, appStoreId }; // this will clear appStoreId when updating from a repo and set it if passed in for update route
const updateConfig = { skipBackup, manifest }; // this will clear appStoreId when updating from a repo and set it if passed in for update route
if ('appStoreId' in data) updateConfig.appStoreId = data.appStoreId;
// prevent user from installing a app with different manifest id over an existing app
// this allows cloudron install -f --app <appid> for an app installed from the appStore