Fix database id escaping (make safeURLName idempotent) PR: #784 PR-URL: https://github.com/apache/couchdb-fauxton/pull/784 Reviewed-By: Robert Kowalski <r...@kowalski.gd>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/ef1ecc8b Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/ef1ecc8b Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/ef1ecc8b Branch: refs/heads/master Commit: ef1ecc8b16c8e7e20228138a6384af21800bbe4f Parents: fd758c0 Author: Pierre Guilleminot <pierre.guillemi...@gmail.com> Authored: Wed Oct 12 19:48:42 2016 +0200 Committer: Robert Kowalski <robertkowal...@apache.org> Committed: Thu Oct 13 16:34:52 2016 +0200 ---------------------------------------------------------------------- app/core/utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ef1ecc8b/app/core/utils.js ---------------------------------------------------------------------- diff --git a/app/core/utils.js b/app/core/utils.js index 35ce2db..c159eb1 100644 --- a/app/core/utils.js +++ b/app/core/utils.js @@ -68,7 +68,9 @@ var utils = { safeURLName: function (name) { var testName = name || ""; - var checkforBad = testName.match(/[\$\-/,+-]/g); + // These special caracters are allowed by couch: _, $, (, ), +, -, and / + // From them only $ + and / are to be escaped in a URI component. + var checkforBad = testName.match(/[$+/]/g); return (checkforBad !== null) ? encodeURIComponent(name) : name; },