From 1c0a6e9c637fcfec2990c6318b3c69e4c7591d76 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Wed, 29 Sep 2010 19:13:13 +0000 Subject: 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 --- src/couchdb/couch_rep.erl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') 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}]). -- cgit v1.2.3