You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2023/03/02 14:15:18 UTC

[couchdb] branch main updated: Only allow POST request for /{db}/_view_cleanup (#4449)

This is an automated email from the ASF dual-hosted git repository.

ronny pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/main by this push:
     new c0b8839bf Only allow POST request for /{db}/_view_cleanup (#4449)
c0b8839bf is described below

commit c0b8839bf28bd2c914d71a4dfafd3ea508c3040a
Author: Ronny Berndt <ro...@apache.org>
AuthorDate: Thu Mar 2 15:15:09 2023 +0100

    Only allow POST request for /{db}/_view_cleanup (#4449)
---
 src/chttpd/src/chttpd_db.erl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index db506e8e2..f2bf447b7 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -308,9 +308,11 @@ handle_compact_req(#httpd{method = 'POST'} = Req, Db) ->
 handle_compact_req(Req, _Db) ->
     send_method_not_allowed(Req, "POST").
 
-handle_view_cleanup_req(Req, Db) ->
+handle_view_cleanup_req(#httpd{method = 'POST'} = Req, Db) ->
     ok = fabric:cleanup_index_files_all_nodes(Db),
-    send_json(Req, 202, {[{ok, true}]}).
+    send_json(Req, 202, {[{ok, true}]});
+handle_view_cleanup_req(Req, _Db) ->
+    send_method_not_allowed(Req, "POST").
 
 handle_partition_req(#httpd{path_parts = [_, _]} = _Req, _Db) ->
     throw({bad_request, invalid_partition_req});