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 2015/07/01 02:57:17 UTC
couch-mrview commit: updated
refs/heads/537-whitelist-builtin-reduce-funs to edb2c85
Repository: couchdb-couch-mrview
Updated Branches:
refs/heads/537-whitelist-builtin-reduce-funs [created] edb2c8517
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/537-whitelist-builtin-reduce-funs
Commit: edb2c8517485a701ac38ebc8c4de2cd4df5a12a0
Parents: 19737b7
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Tue Jun 30 20:55:05 2015 -0400
Committer: Adam Kocoloski <ad...@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)