diff --git a/src/appdb.js b/src/appdb.js index 64a54b489..8e4a688df 100644 --- a/src/appdb.js +++ b/src/appdb.js @@ -117,7 +117,7 @@ function postProcess(result) { let volumeReadOnlys = JSON.parse(result.volumeReadOnlys); delete result.volumeReadOnlys; - result.mounts = volumeIds[0] === null ? [] : volumeIds.map((v, idx) => { return { volumeId: v, readOnly: volumeReadOnlys[idx] }; }); // NOTE: volumeIds is [null] when volumes of an app is empty + result.mounts = volumeIds[0] === null ? [] : volumeIds.map((v, idx) => { return { volumeId: v, readOnly: !!volumeReadOnlys[idx] }; }); // NOTE: volumeIds is [null] when volumes of an app is empty result.error = safe.JSON.parse(result.errorJson); delete result.errorJson; @@ -457,7 +457,7 @@ function updateWithConstraints(id, app, constraints, callback) { if (p === 'manifest' || p === 'tags' || p === 'accessRestriction' || p === 'debugMode' || p === 'error' || p === 'reverseProxyConfig' || p === 'servicesConfig') { fields.push(`${p}Json = ?`); values.push(JSON.stringify(app[p])); - } else if (p !== 'portBindings' && p !== 'location' && p !== 'domain' && p !== 'alternateDomains' && p !== 'env') { + } else if (p !== 'portBindings' && p !== 'location' && p !== 'domain' && p !== 'alternateDomains' && p !== 'env' && p !== 'mounts') { fields.push(p + ' = ?'); values.push(app[p]); } diff --git a/src/routes/apps.js b/src/routes/apps.js index 6676f3277..2fd34f6bb 100644 --- a/src/routes/apps.js +++ b/src/routes/apps.js @@ -770,7 +770,7 @@ function setMounts(req, res, next) { assert.strictEqual(typeof req.body, 'object'); assert.strictEqual(typeof req.resource, 'object'); - if (Array.isArray(req.body.mounts)) return next(new HttpError(400, 'mounts should be an array')); + if (!Array.isArray(req.body.mounts)) return next(new HttpError(400, 'mounts should be an array')); for (let m of req.body.mounts) { if (!m || typeof m !== 'object') return next(new HttpError(400, 'mounts must be an object')); if (typeof m.volumeId !== 'string') return next(new HttpError(400, 'volumeId must be a string'));