Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CCCD010423 for ; Tue, 18 Mar 2014 10:30:50 +0000 (UTC) Received: (qmail 85740 invoked by uid 500); 18 Mar 2014 10:30:49 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 85478 invoked by uid 500); 18 Mar 2014 10:30:46 -0000 Mailing-List: contact dev-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 dev@couchdb.apache.org Received: (qmail 85389 invoked by uid 99); 18 Mar 2014 10:30:44 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Mar 2014 10:30:44 +0000 Date: Tue, 18 Mar 2014 10:30:44 +0000 (UTC) From: "richard delorenzi (JIRA)" To: dev@couchdb.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (COUCHDB-2204) rewrite of lists fail when not for key MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 richard delorenzi created COUCHDB-2204: ------------------------------------------ Summary: rewrite of lists fail when not for key Key: COUCHDB-2204 URL: https://issues.apache.org/jira/browse/COUCHDB-2204 Project: CouchDB Issue Type: Bug Security Level: public (Regular issues) Components: HTTP Interface Reporter: richard delorenzi I have the following fragment in rewrite.json, {{quote}} { "from": "server_lib/:~name", "to": "_list/sub/design", "query": { "path": ["lib", ":~name" ], "include_docs": "true" } }, {{quote}} when I try to fetch the page with {{quote}} curl -s -D /dev/stderr -H "Accept: application/json" 'http://localhost:5984/q-couch-test/_design/couch-experiment/_rewrite/server_lib/myLib' {{quote}} I get this error {{quote}} log error: [Tue, 18 Mar 2014 09:54:31 GMT] [info] [<0.5037.0>] Stacktrace: [{erlang,iolist_to_binary, [[<<"myLib">>,{[]}]], []}, {couch_httpd_rewrite, '-maybe_encode_bindings/1-fun-0-',2, [{file,"couch_httpd_rewrite.erl"}, {line,453}]}, {lists,foldl,3, [{file,"lists.erl"},{line,1197}]}, {couch_httpd_rewrite,handle_rewrite_req,3, [{file,"couch_httpd_rewrite.erl"}, {line,147}]}, {couch_httpd_db,do_db_req,2, [{file,"couch_httpd_db.erl"},{line,230}]}, {couch_httpd,handle_request_int,5, [{file,"couch_httpd.erl"},{line,317}]}, {mochiweb_http,headers,5, [{file,"mochiweb_http.erl"},{line,136}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,227}]}] {{quote}} The bug seems to be in couch_httpd_rewrite.erl in maybe_json. It treats keys specially, so we can represent keys as lists but not other query strings. e.g. this rewrite fragment works {{quote}} { "from": "view/by_name/:~type", "to": "_view/all-by-name", "query": { "startkey": [ ":~type", null ], "endkey": [ ":~type", {} ] } }, {{quote}} -- This message was sent by Atlassian JIRA (v6.2#6252)