diff options
Diffstat (limited to 'src/couchdb/couch_httpd_view.erl')
-rw-r--r-- | src/couchdb/couch_httpd_view.erl | 9 |
1 files changed, 9 insertions, 0 deletions
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, |