couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject [1/3] couch-mrview commit: updated refs/heads/master to 1c10f21
Date Wed, 01 Jul 2015 13:22:03 GMT
Repository: couchdb-couch-mrview
Updated Branches:
  refs/heads/master 19737b758 -> 1c10f21cf


Validate named reduce function against whitelist

COUCHDB-537


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

Branch: refs/heads/master
Commit: edb2c8517485a701ac38ebc8c4de2cd4df5a12a0
Parents: 19737b7
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Tue Jun 30 20:55:05 2015 -0400
Committer: Adam Kocoloski <adam@cloudant.com>
Committed: Tue Jun 30 20:55:05 2015 -0400

----------------------------------------------------------------------
 src/couch_mrview.erl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/edb2c851/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl
index 5583f1f..5d56af8 100644
--- a/src/couch_mrview.erl
+++ b/src/couch_mrview.erl
@@ -64,8 +64,15 @@ validate(DbName, DDoc) ->
     ValidateView = fun(Proc, #mrview{def=MapSrc, reduce_funs=Reds}=View) ->
         couch_query_servers:try_compile(Proc, map, GetName(View), MapSrc),
         lists:foreach(fun
-            ({_RedName, <<"_", _/binary>>}) ->
+            ({_RedName, <<"_sum", _/binary>>}) ->
                 ok;
+            ({_RedName, <<"_count", _/binary>>}) ->
+                ok;
+            ({_RedName, <<"_stats", _/binary>>}) ->
+                ok;
+            ({_RedName, <<"_", _/binary>> = Bad}) ->
+                Msg = ["`", Bad, "` is not a supported reduce function."],
+                throw({invalid_design_doc, Msg});
             ({RedName, RedSrc}) ->
                 couch_query_servers:try_compile(Proc, reduce, RedName, RedSrc)
         end, Reds)


Mime
View raw message