jiangphcn closed pull request #1717: Fix nasty 500 error on POST to /_config
URL: https://github.com/apache/couchdb/pull/1717
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/rebar.config.script b/rebar.config.script
index 65c3a8a043..c3c05dde3f 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -48,7 +48,7 @@ SubDirs = [
DepDescs = [
%% Independent Apps
-{config, "config", {tag, "2.1.3"}},
+{config, "config", {tag, "2.1.4"}},
{b64url, "b64url", {tag, "1.0.1"}},
{ets_lru, "ets-lru", {tag, "1.0.0"}},
{khash, "khash", {tag, "1.0.1"}},
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl
index fc03fb5124..efa7ef338f 100644
--- a/src/chttpd/src/chttpd_misc.erl
+++ b/src/chttpd/src/chttpd_misc.erl
@@ -323,8 +323,12 @@ handle_node_req(#httpd{method='DELETE',path_parts=[_,
Node, <<"_config">>, Secti
undefined ->
throw({not_found, unknown_config_value});
OldValue ->
- call_node(Node, config, delete, [Section, Key, Persist]),
- send_json(Req, 200, list_to_binary(OldValue))
+ case call_node(Node, config, delete, [Section, Key, Persist]) of
+ ok ->
+ send_json(Req, 200, list_to_binary(OldValue));
+ {error, Reason} ->
+ chttpd:send_error(Req, {bad_request, Reason})
+ end
end;
handle_node_req(#httpd{path_parts=[_, _Node, <<"_config">>, _Section,
_Key]}=Req) ->
send_method_not_allowed(Req, "GET,PUT,DELETE");
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services