You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2016/10/13 14:35:17 UTC

[1/2] fauxton commit: updated refs/heads/master to a06c648

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master fd758c015 -> a06c64884


add tests for encoding issue


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/a06c6488
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/a06c6488
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/a06c6488

Branch: refs/heads/master
Commit: a06c64884b4f86e00f774e0e810018c4513269fe
Parents: ef1ecc8
Author: Robert Kowalski <ro...@apache.org>
Authored: Thu Oct 13 16:33:09 2016 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Thu Oct 13 16:34:52 2016 +0200

----------------------------------------------------------------------
 app/core/tests/utilsSpec.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a06c6488/app/core/tests/utilsSpec.js
----------------------------------------------------------------------
diff --git a/app/core/tests/utilsSpec.js b/app/core/tests/utilsSpec.js
index c5632f5..326e8ab 100644
--- a/app/core/tests/utilsSpec.js
+++ b/app/core/tests/utilsSpec.js
@@ -47,6 +47,18 @@ describe('Utils', function () {
     });
   });
 
+  describe('safeURLName', function () {
+
+    it('is idempotent', function () {
+      assert.equal('foo-bar%2Fbaz', utils.safeURLName(utils.safeURLName('foo-bar/baz')));
+      assert.equal('foo-bar%2Bbaz', utils.safeURLName(utils.safeURLName('foo-bar+baz')));
+    });
+
+    it('encodes special chars', function () {
+      assert.equal('foo-bar%2Fbaz', utils.safeURLName('foo-bar/baz'));
+    });
+  });
+
   describe('isSystemDatabase', function () {
 
     it('detects system databases', function () {


[2/2] fauxton commit: updated refs/heads/master to a06c648

Posted by ro...@apache.org.
Fix database id escaping (make safeURLName idempotent)

PR: #784
PR-URL: https://github.com/apache/couchdb-fauxton/pull/784
Reviewed-By: Robert Kowalski <ro...@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 <pi...@gmail.com>
Authored: Wed Oct 12 19:48:42 2016 +0200
Committer: Robert Kowalski <ro...@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;
   },