From 0694641fe917ab1354739c2660a2deb4f823983a Mon Sep 17 00:00:00 2001 From: Gregor Martynus Date: Mon, 21 Dec 2015 02:00:57 +0100 Subject: [PATCH] fix: allow saving _design docs --- lib/validate-doc-update.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/validate-doc-update.js b/lib/validate-doc-update.js index 9703631..561e9ad 100644 --- a/lib/validate-doc-update.js +++ b/lib/validate-doc-update.js @@ -7,9 +7,13 @@ module.exports = function (newDoc, oldDoc, userCtx, secObj) { throw error } + if (newDoc._id.substr(0, 8) === '_design/') { + return + } + if ((oldDoc && oldDoc.type !== 'user') || newDoc.type !== 'user') { throwError('doc.type must be user') - } // we only allow user docs for now + } if (!newDoc.name) { throwError('doc.name is required')