couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benk...@apache.org
Subject fauxton commit: updated refs/heads/master to b5936be
Date Thu, 01 Oct 2015 15:22:33 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master ebd9ced89 -> b5936be43


Fix for error caused by newlines in View search -> keys field

Curious, very specific bug. When doing a search on a View and entering
a value for the Keys field that contains a newline between two values,
the encoding of the URL gets all messed up and you see a
"missing_named_view" error get thrown within the UI. This ticket simply
strips out newlines in that field.

How to reproduce:
- create a new view
- click on the "Query Options" section and click on Keys to expand
that section. Enter:

["one",
"two"]

Note the newline after the "one" line.
- submit the form.

Result: JS errors and the error notification.


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

Branch: refs/heads/master
Commit: b5936be43b703fa3d79fe7c12b791969d9127870
Parents: ebd9ced
Author: Ben Keen <ben.keen@gmail.com>
Authored: Mon Sep 28 11:32:29 2015 -0700
Committer: Ben Keen <ben.keen@gmail.com>
Committed: Thu Oct 1 08:22:18 2015 -0700

----------------------------------------------------------------------
 app/addons/documents/queryoptions/stores.js     |  2 +-
 .../tests/nightwatch/viewQueryOptions.js        | 21 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b5936be4/app/addons/documents/queryoptions/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/stores.js b/app/addons/documents/queryoptions/stores.js
index 9fde62a..f09b3c8 100644
--- a/app/addons/documents/queryoptions/stores.js
+++ b/app/addons/documents/queryoptions/stores.js
@@ -207,7 +207,7 @@ function (app, FauxtonAPI, ActionTypes) {
           params.end_key = betweenKeys.endkey;
         }
       } else if (this._showByKeys) {
-        params.keys = this._byKeys;
+        params.keys = this._byKeys.replace(/\r?\n/g, '');
       }
 
       if (this._updateSeq) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b5936be4/app/addons/documents/tests/nightwatch/viewQueryOptions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewQueryOptions.js b/app/addons/documents/tests/nightwatch/viewQueryOptions.js
index 434bad1..4359bb3 100644
--- a/app/addons/documents/tests/nightwatch/viewQueryOptions.js
+++ b/app/addons/documents/tests/nightwatch/viewQueryOptions.js
@@ -30,5 +30,26 @@ module.exports = {
       .assert.elementNotPresent('#right-content [data-id="document_0"]')
       .assert.elementPresent('#right-content [data-id="document_1"]')
     .end();
+  },
+
+  'Edit view: Queryoptions works querying index with newlines in key field': function (client)
{
+    /*jshint multistr: true */
+    var waitTime = client.globals.maxWaitTime,
+      newDatabaseName = client.globals.testDatabaseName,
+      baseUrl = client.globals.test_settings.launch_url;
+
+    client
+      .populateDatabase(newDatabaseName, 3)
+      .loginToGUI()
+      .url(baseUrl + '/#/database/' + newDatabaseName + '/_design/keyview/_view/keyview')
+      .clickWhenVisible('#toggle-query', waitTime, false)
+      .clickWhenVisible('#byKeys', waitTime, false)
+      .setValue('#keys-input', '["document_1",\n"document_2"]')
+      .clickWhenVisible('#query-options .btn-success')
+      .waitForElementNotPresent('#right-content [data-id="document_0"]', waitTime, false)
+      .assert.elementNotPresent('#right-content [data-id="document_0"]')
+      .assert.elementPresent('#right-content [data-id="document_1"]')
+      .end();
   }
+
 };


Mime
View raw message