ZzyuR2gM0JVdDmgGhjXbI changeset

Changeset333339666130 (b)
Parent633861623739 (a)
ab
00diff --git a/src/couchdb/couch_httpd_rewrite.erl b/src/couchdb/couch_httpd_rewrite.erl
...
1-index 6c3d0e3..5fb0bee 100644
1+index 6c3d0e3..998f41f 100644
...
22--- a/src/couchdb/couch_httpd_rewrite.erl
33+++ b/src/couchdb/couch_httpd_rewrite.erl
...
4-@@ -236,46 +236,20 @@ make_query_list([{Key, {Value}}|Rest], Bindings, Acc) ->
4-     Value1 = to_json({Value}),
4-     make_query_list(Rest, Bindings, [{to_binding(Key), Value1}|Acc]);
4- make_query_list([{Key, Value}|Rest], Bindings, Acc) when is_binary(Value) ->
4--    Value1 = replace_var(Key, Value, Bindings),
4-+    Value1 = replace_var(Value, Bindings),
4+@@ -239,43 +239,17 @@ make_query_list([{Key, Value}|Rest], Bindings, Acc) when is_binary(Value) ->
4+     Value1 = replace_var(Key, Value, Bindings),
...
1010     make_query_list(Rest, Bindings, [{to_binding(Key), Value1}|Acc]);
1111 make_query_list([{Key, Value}|Rest], Bindings, Acc) when is_list(Value) ->
1212-    Value1 = replace_var(Key, Value, Bindings),
...
13-+    Value1 = to_json([replace_var(V, Bindings) || V <- Value]),
13++    Value1 = to_json([replace_var(Key, V, Bindings) || V <- Value]),
...
1414     make_query_list(Rest, Bindings, [{to_binding(Key), Value1}|Acc]);
1515 make_query_list([{Key, Value}|Rest], Bindings, Acc) ->
1616     make_query_list(Rest, Bindings, [{to_binding(Key), Value}|Acc]).
...
4747-            end
4848-    end.
4949-
...
50-+replace_var(<<":", Var/binary>> = Value, Bindings) ->
50++replace_var(_Key, <<":", Var/binary>> = Value, Bindings) ->
...
5151+    get_var(Var, Bindings, Value);
...
52-+replace_var(Value, _Bindings) when is_binary(Value) ->
52++replace_var(_Key, Value, _Bindings) when is_binary(Value) ->
...
5353+    Value;
...
54-+replace_var(Value, _Bindings) ->
54++replace_var(_Key, Value, _Bindings) ->
...
5555+    to_json(Value).
5656 
5757 get_var(VarName, Props, Default) ->
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- Revision 633861623739
+++ Revision 333339666130
@@ -1,17 +1,13 @@
diff --git a/src/couchdb/couch_httpd_rewrite.erl b/src/couchdb/couch_httpd_rewrite.erl
-index 6c3d0e3..5fb0bee 100644
+index 6c3d0e3..998f41f 100644
--- a/src/couchdb/couch_httpd_rewrite.erl
+++ b/src/couchdb/couch_httpd_rewrite.erl
-@@ -236,46 +236,20 @@ make_query_list([{Key, {Value}}|Rest], Bindings, Acc) ->
- Value1 = to_json({Value}),
- make_query_list(Rest, Bindings, [{to_binding(Key), Value1}|Acc]);
- make_query_list([{Key, Value}|Rest], Bindings, Acc) when is_binary(Value) ->
-- Value1 = replace_var(Key, Value, Bindings),
-+ Value1 = replace_var(Value, Bindings),
+@@ -239,43 +239,17 @@ make_query_list([{Key, Value}|Rest], Bindings, Acc) when is_binary(Value) ->
+ Value1 = replace_var(Key, Value, Bindings),
make_query_list(Rest, Bindings, [{to_binding(Key), Value1}|Acc]);
make_query_list([{Key, Value}|Rest], Bindings, Acc) when is_list(Value) ->
- Value1 = replace_var(Key, Value, Bindings),
-+ Value1 = to_json([replace_var(V, Bindings) || V <- Value]),
++ Value1 = to_json([replace_var(Key, V, Bindings) || V <- Value]),
make_query_list(Rest, Bindings, [{to_binding(Key), Value1}|Acc]);
make_query_list([{Key, Value}|Rest], Bindings, Acc) ->
make_query_list(Rest, Bindings, [{to_binding(Key), Value}|Acc]).
@@ -48,11 +44,11 @@
- end
- end.
-
-+replace_var(<<":", Var/binary>> = Value, Bindings) ->
++replace_var(_Key, <<":", Var/binary>> = Value, Bindings) ->
+ get_var(Var, Bindings, Value);
-+replace_var(Value, _Bindings) when is_binary(Value) ->
++replace_var(_Key, Value, _Bindings) when is_binary(Value) ->
+ Value;
-+replace_var(Value, _Bindings) ->
++replace_var(_Key, Value, _Bindings) ->
+ to_json(Value).
get_var(VarName, Props, Default) ->