diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-29 19:13:13 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-29 19:13:13 +0000 |
commit | 1c0a6e9c637fcfec2990c6318b3c69e4c7591d76 (patch) | |
tree | 8919cdb7b337c81c64bc7155e9ded1fad7c6bbd8 | |
parent | cff79d01f26f2a4917204fcf3dd8d4d4d57271bc (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
-rw-r--r-- | src/couchdb/couch_rep.erl | 11 |
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}]). |