couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to d1db3d9
Date Fri, 24 Oct 2014 09:05:15 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master a02cc7fe0 -> d1db3d984


Revert "Url-encode document-ids properly"

This reverts commit 92964af8ee93c53677b8abaea9463fd9ae7a4d7f.

This causes that you can not save an edited design document


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

Branch: refs/heads/master
Commit: d1db3d984ee9b185decabb553dd8301c5e149f87
Parents: a02cc7f
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Fri Oct 24 11:00:09 2014 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Fri Oct 24 11:03:13 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/views-doceditor.js |  3 +--
 app/core/tests/utilsSpec.js             | 27 ---------------------------
 app/core/utils.js                       |  9 ++++-----
 3 files changed, 5 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/d1db3d98/app/addons/documents/views-doceditor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js
index 7de0be8..bd15596 100644
--- a/app/addons/documents/views-doceditor.js
+++ b/app/addons/documents/views-doceditor.js
@@ -386,7 +386,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, resizeColumns,
prett
 
         this.model.save().then(function () {
           editor.editSaved();
-          FauxtonAPI.navigate('/database/' + that.database.safeID() + '/' + app.utils.safeURLName(that.model.id));
+          FauxtonAPI.navigate('/database/' + that.database.safeID() + '/' + that.model.id);
         }).fail(function(xhr) {
           var responseText = JSON.parse(xhr.responseText).reason;
           FauxtonAPI.addNotification({
@@ -423,7 +423,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, resizeColumns,
prett
       }
 
       json = JSON.parse(this.editor.getValue());
-      json._id = app.utils.safeURLName(json._id);
 
       this.model.clear().set(json, {validate: true});
       if (this.model.validationError) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/d1db3d98/app/core/tests/utilsSpec.js
----------------------------------------------------------------------
diff --git a/app/core/tests/utilsSpec.js b/app/core/tests/utilsSpec.js
deleted file mode 100644
index 2629699..0000000
--- a/app/core/tests/utilsSpec.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-define([
-  "app",
-  "testUtils"
-], function (app, testUtils) {
-  var assert = testUtils.assert;
-
-  describe("utils", function () {
-    describe("safeURLName", function () {
-      it("should encode urls with a % (COUCHDB-2342)", function () {
-        var res = app.utils.safeURLName("design%20foo");
-        assert.equal(res, "design%2520foo");
-      });
-    });
-  });
-});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/d1db3d98/app/core/utils.js
----------------------------------------------------------------------
diff --git a/app/core/utils.js b/app/core/utils.js
index 0ea6770..d3699c7 100644
--- a/app/core/utils.js
+++ b/app/core/utils.js
@@ -92,11 +92,10 @@ function ($, _) {
       return name.replace(/[^\w\s]/gi,"");
     },
 
-    safeURLName: function (name) {
-      var testName = name || "",
-          hasBadChar = /[\$\-/%,+-]/g.test(testName);
-
-      return hasBadChar ? encodeURIComponent(name) : name;
+    safeURLName: function(name){
+      var testName = name || "";
+      var checkforBad = testName.match(/[\$\-/,+-]/g);
+      return (checkforBad !== null)?encodeURIComponent(name):name;
     }
   };
 


Mime
View raw message