You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by benkeen <gi...@git.apache.org> on 2015/09/28 20:36:33 UTC

[GitHub] couchdb-fauxton pull request: Fix for error caused by newlines in ...

GitHub user benkeen opened a pull request:

    https://github.com/apache/couchdb-fauxton/pull/538

    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.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/benkeen/couchdb-fauxton view-search-newline-issue

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-fauxton/pull/538.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #538
    
----
commit e95f901bfe70f62863c0ce137539edf2b74bb96f
Author: Ben Keen <be...@gmail.com>
Date:   2015-09-28T18:32:29Z

    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.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Fix for error caused by newlines in ...

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/538#issuecomment-144761281
  
    Merged as b5936be


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Fix for error caused by newlines in ...

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/538#issuecomment-144156868
  
    Thanks @robertkowalski. Confirmed that this now works on Windows. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Fix for error caused by newlines in ...

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/538#discussion_r40693731
  
    --- Diff: app/addons/documents/queryoptions/stores.js ---
    @@ -211,7 +211,7 @@ function (app, FauxtonAPI, ActionTypes) {
               params.end_key = betweenKeys.endkey;
             }
           } else if (this._showByKeys) {
    -        params.keys = this._byKeys;
    +        params.keys = this._byKeys.replace(/\n/g, '');
    --- End diff --
    
    Good point! That makes sense.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Fix for error caused by newlines in ...

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen closed the pull request at:

    https://github.com/apache/couchdb-fauxton/pull/538


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Fix for error caused by newlines in ...

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/538#discussion_r40660914
  
    --- Diff: app/addons/documents/queryoptions/stores.js ---
    @@ -211,7 +211,7 @@ function (app, FauxtonAPI, ActionTypes) {
               params.end_key = betweenKeys.endkey;
             }
           } else if (this._showByKeys) {
    -        params.keys = this._byKeys;
    +        params.keys = this._byKeys.replace(/\n/g, '');
    --- End diff --
    
    that probably won't work for windows `\r\n` newlines
    
    untested alternative: `/\r?\n/`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Fix for error caused by newlines in ...

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/538#issuecomment-144686925
  
    +1, merge it! :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---