You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2023/05/09 17:04:58 UTC

[couchdb] branch revert-invalid-path-fix created (now ba52120ba)

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

rnewson pushed a change to branch revert-invalid-path-fix
in repository https://gitbox.apache.org/repos/asf/couchdb.git


      at ba52120ba Revert "fix(mango): GET invalid path under `_index` should not cause 500"

This branch includes the following new commits:

     new ba52120ba Revert "fix(mango): GET invalid path under `_index` should not cause 500"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Revert "fix(mango): GET invalid path under `_index` should not cause 500"

Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch revert-invalid-path-fix
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit ba52120ba1d8be19c1b2940cd74053d068fba01c
Author: Robert Newson <rn...@apache.org>
AuthorDate: Tue May 9 17:22:01 2023 +0100

    Revert "fix(mango): GET invalid path under `_index` should not cause 500"
    
    This reverts commit c1195e43c0b55f99892bb5d6b593de178499b969.
---
 src/mango/src/mango_httpd.erl        | 6 +++---
 src/mango/test/01-index-crud-test.py | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/mango/src/mango_httpd.erl b/src/mango/src/mango_httpd.erl
index 935cf5890..3e58288da 100644
--- a/src/mango/src/mango_httpd.erl
+++ b/src/mango/src/mango_httpd.erl
@@ -107,6 +107,8 @@ handle_index_req(#httpd{method = 'POST', path_parts = [_, _]} = Req, Db) ->
                 end
         end,
     chttpd:send_json(Req, {[{result, Status}, {id, Id}, {name, Name}]});
+handle_index_req(#httpd{path_parts = [_, _]} = Req, _Db) ->
+    chttpd:send_method_not_allowed(Req, "GET,POST");
 %% Essentially we just iterate through the list of ddoc ids passed in and
 %% delete one by one. If an error occurs, all previous documents will be
 %% deleted, but an error will be thrown for the current ddoc id.
@@ -187,9 +189,7 @@ handle_index_req(
             ?MANGO_ERROR({error_saving_ddoc, Error})
     end;
 handle_index_req(#httpd{path_parts = [_, _, _DDocId0, _Type, _Name]} = Req, _Db) ->
-    chttpd:send_method_not_allowed(Req, "DELETE");
-handle_index_req(#httpd{path_parts = [_, _ | _]} = Req, _Db) ->
-    chttpd:send_method_not_allowed(Req, "GET,POST").
+    chttpd:send_method_not_allowed(Req, "DELETE").
 
 handle_explain_req(#httpd{method = 'POST'} = Req, Db) ->
     chttpd:validate_ctype(Req, "application/json"),
diff --git a/src/mango/test/01-index-crud-test.py b/src/mango/test/01-index-crud-test.py
index e85e1d8ea..dd70e7eea 100644
--- a/src/mango/test/01-index-crud-test.py
+++ b/src/mango/test/01-index-crud-test.py
@@ -88,10 +88,6 @@ class IndexCrudTests(mango.DbPerClass):
             else:
                 raise AssertionError("bad create index")
 
-    def test_bad_url(self):
-        r = self.db.sess.get(self.db.path("_index/foo"))
-        self.assertEqual(r.status_code, 405)
-
     def test_create_idx_01(self):
         fields = ["foo", "bar"]
         ret = self.db.create_index(fields, name="idx_01")