couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [2/2] fauxton commit: updated refs/heads/master to 2c37da5
Date Tue, 23 Jun 2015 06:42:25 GMT
Encode Url for document id

This fixes the issue of documents created with '\' causing the back
button to not work properly.
This fixes COUCHDB-2717


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

Branch: refs/heads/master
Commit: 32917ab763b75d1ddbbfdd93a12a4315f662dd23
Parents: 52753f1
Author: Garren Smith <garren.smith@gmail.com>
Authored: Tue Jun 16 15:59:50 2015 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Tue Jun 23 08:41:49 2015 +0200

----------------------------------------------------------------------
 app/addons/documents/base.js            |  2 +-
 app/addons/documents/tests/routeSpec.js | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/32917ab7/app/addons/documents/base.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/base.js b/app/addons/documents/base.js
index ba4a892..348b16d 100644
--- a/app/addons/documents/base.js
+++ b/app/addons/documents/base.js
@@ -75,7 +75,7 @@ function (app, FauxtonAPI, Documents) {
     },
 
     app: function (database, doc) {
-      return '/database/' + database + '/' + doc;
+      return '/database/' + database + '/' + encodeURI(doc);
     },
 
     apiurl: function (database, doc) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/32917ab7/app/addons/documents/tests/routeSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/routeSpec.js b/app/addons/documents/tests/routeSpec.js
index a6aab28..84bd9f8 100644
--- a/app/addons/documents/tests/routeSpec.js
+++ b/app/addons/documents/tests/routeSpec.js
@@ -11,12 +11,14 @@
 // the License.
 
 define([
+        'api',
+        'addons/documents/base',
         'addons/documents/routes',
         'addons/documents/header/header.actions',
         'addons/documents/index-results/actions',
 
         'testUtils'
-], function (Documents, HeaderActions, IndexResultsActions, testUtils) {
+], function (FauxtonAPI, Base, Documents, HeaderActions, IndexResultsActions, testUtils)
{
   var assert = testUtils.assert;
   var DocumentRoute = Documents.RouteObjects[2];
 
@@ -50,4 +52,14 @@ define([
     });
 
   });
+
+  describe('Fauxton Urls', function () {
+
+    it('document app encodes document id', function () {
+      var id = "\foo";
+      var url = FauxtonAPI.urls('document', 'app', 'fake-db', id);
+      assert.deepEqual("/database/fake-db/%0Coo", url);
+    });
+
+  });
 });


Mime
View raw message