You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2017/03/01 16:39:20 UTC

[33/50] couch commit: updated refs/heads/2971-count-distinct to ee32cd5

Validate that count in /_uuids is positive


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/5d793046
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/5d793046
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/5d793046

Branch: refs/heads/2971-count-distinct
Commit: 5d7930461f420683276dddc02a7fd4410c1b5439
Parents: eaff862
Author: Eric Avdey <ei...@eiri.ca>
Authored: Wed Jan 18 09:44:15 2017 -0400
Committer: Eric Avdey <ei...@eiri.ca>
Committed: Wed Jan 18 10:32:19 2017 -0400

----------------------------------------------------------------------
 src/couch_httpd_misc_handlers.erl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5d793046/src/couch_httpd_misc_handlers.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_misc_handlers.erl b/src/couch_httpd_misc_handlers.erl
index 0cbbdd8..8d7ce5e 100644
--- a/src/couch_httpd_misc_handlers.erl
+++ b/src/couch_httpd_misc_handlers.erl
@@ -130,10 +130,12 @@ handle_uuids_req(#httpd{method='GET'}=Req) ->
     Count = try list_to_integer(couch_httpd:qs_value(Req, "count", "1")) of
         N when N > Max ->
             throw({forbidden, <<"count parameter too large">>});
+        N when N < 0 ->
+            throw({bad_request, <<"count must be a positive integer">>});
         N -> N
     catch
         error:badarg ->
-            throw({bad_request, <<"count parameter is not an integer">>})
+            throw({bad_request, <<"count must be a positive integer">>})
     end,
     UUIDs = [couch_uuids:new() || _ <- lists:seq(1, Count)],
     Etag = couch_httpd:make_etag(UUIDs),