Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB8F117B5E for ; Thu, 1 Oct 2015 15:22:33 +0000 (UTC) Received: (qmail 26932 invoked by uid 500); 1 Oct 2015 15:22:33 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 26886 invoked by uid 500); 1 Oct 2015 15:22:33 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 26877 invoked by uid 99); 1 Oct 2015 15:22:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Oct 2015 15:22:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5AAFBE1536; Thu, 1 Oct 2015 15:22:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: benkeen@apache.org To: commits@couchdb.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: fauxton commit: updated refs/heads/master to b5936be Date: Thu, 1 Oct 2015 15:22:33 +0000 (UTC) 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 Authored: Mon Sep 28 11:32:29 2015 -0700 Committer: Ben Keen 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(); } + };