summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-09-29 19:13:13 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-09-29 19:13:13 +0000
commit1c0a6e9c637fcfec2990c6318b3c69e4c7591d76 (patch)
tree8919cdb7b337c81c64bc7155e9ded1fad7c6bbd8 /src
parentcff79d01f26f2a4917204fcf3dd8d4d4d57271bc (diff)
Add missing expression to close the database (COUCHDB-892 related).
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1002810 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_rep.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl
index 85ecc99e..60cc4b80 100644
--- a/src/couchdb/couch_rep.erl
+++ b/src/couchdb/couch_rep.erl
@@ -514,9 +514,14 @@ filter_code(Filter, Props, UserCtx) ->
re:run(Filter, "(.*?)/(.*)", [{capture, [1, 2], binary}]),
ProxyParams = parse_proxy_params(?getv(<<"proxy">>, Props, [])),
Source = open_db(?getv(<<"source">>, Props), UserCtx, ProxyParams),
- {ok, #doc{body = Body}} = open_doc(Source, <<"_design/", DDocName/binary>>),
- Code = couch_util:get_nested_json_value(Body, [<<"filters">>, FilterName]),
- re:replace(Code, "^\s*(.*?)\s*$", "\\1", [{return, binary}]).
+ try
+ {ok, DDoc} = open_doc(Source, <<"_design/", DDocName/binary>>),
+ Code = couch_util:get_nested_json_value(
+ DDoc#doc.body, [<<"filters">>, FilterName]),
+ re:replace(Code, "^\s*(.*?)\s*$", "\\1", [{return, binary}])
+ after
+ close_db(Source)
+ end.
maybe_add_trailing_slash(Url) ->
re:replace(Url, "[^/]$", "&/", [{return, list}]).