Updated Branches: refs/heads/master 86b6a1448 -> 2e4d72bd6
Regex fix for creating (from duplicate) Design docs and deleting weirdly encoded docs what begin with _design Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/2e4d72bd Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/2e4d72bd Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/2e4d72bd Branch: refs/heads/master Commit: 2e4d72bd66a5c0bf2e1779178ce9855870a9ffd5 Parents: 86b6a14 Author: suelockwood <deathb...@apache.org> Authored: Mon Jan 13 12:05:24 2014 -0500 Committer: suelockwood <deathb...@apache.org> Committed: Mon Jan 13 12:05:24 2014 -0500 ---------------------------------------------------------------------- src/fauxton/app/addons/documents/resources.js | 2 +- src/fauxton/app/addons/documents/views.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/2e4d72bd/src/fauxton/app/addons/documents/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js index 5e10ded..0fd99f1 100644 --- a/src/fauxton/app/addons/documents/resources.js +++ b/src/fauxton/app/addons/documents/resources.js @@ -56,7 +56,7 @@ function(app, FauxtonAPI) { }, docType: function() { - return this.id.match(/^_design/) ? "design doc" : "doc"; + return this.id && this.id.match(/^_design\//) ? "design doc" : "doc"; }, isEditable: function() { http://git-wip-us.apache.org/repos/asf/couchdb/blob/2e4d72bd/src/fauxton/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index 94332a2..2502b58 100644 --- a/src/fauxton/app/addons/documents/views.js +++ b/src/fauxton/app/addons/documents/views.js @@ -242,7 +242,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum duplicate: function (event) { event.preventDefault(); var newId = this.$('#dup-id').val(), - encodedID = app.utils.safeURLName(newId); + isDDoc = newId.match(/^_design\//), + removeDDocID = newId.replace(/^_design\//,""), + encodedID = isDDoc? "_design/"+ app.utils.safeURLName(removeDDocID):app.utils.safeURLName(newId); this.hideModal(); FauxtonAPI.triggerRouteEvent('duplicateDoc', encodedID);