From 0b55e8a26c9314312732f6481ae62c7a5611f072 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Fri, 20 Mar 2009 10:58:52 +0000 Subject: map queries with group=true query option will return an error. closes COUCHDB-185. changes to jquery.couch.js to support ajaxOptions may be useful for more than just openDoc, will need to be spread to the rest of the API. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@756413 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_view.erl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/couchdb') diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl index 4e922d50..f5f0f5f4 100644 --- a/src/couchdb/couch_httpd_view.erl +++ b/src/couchdb/couch_httpd_view.erl @@ -97,6 +97,7 @@ output_map_view(Req, View, Group, Db, QueryArgs, nil) -> start_key = StartKey, start_docid = StartDocId } = QueryArgs, + validate_map_query(QueryArgs), CurrentEtag = view_group_etag(Group), couch_httpd:etag_respond(Req, CurrentEtag, fun() -> {ok, RowCount} = couch_view:get_row_count(View), @@ -114,6 +115,7 @@ output_map_view(Req, View, Group, Db, QueryArgs, Keys) -> skip = SkipCount, start_docid = StartDocId } = QueryArgs, + validate_map_query(QueryArgs), CurrentEtag = view_group_etag(Group, Keys), couch_httpd:etag_respond(Req, CurrentEtag, fun() -> {ok, RowCount} = couch_view:get_row_count(View), @@ -134,6 +136,13 @@ output_map_view(Req, View, Group, Db, QueryArgs, Keys) -> finish_view_fold(Req, RowCount, FoldResult) end). +validate_map_query(QueryArgs) -> + case QueryArgs#view_query_args.group_level of + 0 -> ok; + _ -> + throw({query_parse_error, <<"Query parameter \"group\" and/or \"group_level\" are invalid for map views.">>}) + end. + output_reduce_view(Req, View, Group, QueryArgs, nil) -> #view_query_args{ start_key = StartKey, -- cgit v1.2.3