You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/01/25 05:44:42 UTC

[couchdb] branch 3.x updated: fixup get _dbs_info corner case

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

vatamane pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/3.x by this push:
     new 9b7fb37  fixup get _dbs_info corner case
9b7fb37 is described below

commit 9b7fb372608a1bef30cf6ade73a3c523148adbc4
Author: jiahuili <Ji...@ibm.com>
AuthorDate: Mon Jan 24 17:25:00 2022 -0600

    fixup get _dbs_info corner case
---
 src/chttpd/src/chttpd_misc.erl | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl
index 4340823..492706f 100644
--- a/src/chttpd/src/chttpd_misc.erl
+++ b/src/chttpd/src/chttpd_misc.erl
@@ -155,17 +155,21 @@ all_dbs_info_callback({row, Row}, #vacc{resp = Resp0} = Acc) when
     Acc#vacc.req#httpd.path_parts =:= [<<"_dbs_info">>]
 ->
     Prepend = couch_mrview_http:prepend_val(Acc),
-    DbName = couch_util:get_value(id, Row),
-    case chttpd_util:get_db_info(DbName) of
-        {ok, DbInfo} ->
-            Chunk = [Prepend, ?JSON_ENCODE({[{key, DbName}, {info, {DbInfo}}]})],
-            {ok, Resp1} = chttpd:send_delayed_chunk(Resp0, Chunk),
-            {ok, Acc#vacc{prepend = ",", resp = Resp1}};
-        {error, database_does_not_exist} ->
-            {ok, Acc#vacc{resp = Resp0}};
-        {error, Reason} ->
-            {ok, Resp1} = chttpd:send_delayed_error(Resp0, Reason),
-            {stop, Acc#vacc{resp = Resp1}}
+    case couch_util:get_value(id, Row) of
+        <<"_design", _/binary>> ->
+            {ok, Acc};
+        DbName ->
+            case chttpd_util:get_db_info(DbName) of
+                {ok, DbInfo} ->
+                    Chunk = [Prepend, ?JSON_ENCODE({[{key, DbName}, {info, {DbInfo}}]})],
+                    {ok, Resp1} = chttpd:send_delayed_chunk(Resp0, Chunk),
+                    {ok, Acc#vacc{prepend = ",", resp = Resp1}};
+                {error, database_does_not_exist} ->
+                    {ok, Acc#vacc{resp = Resp0}};
+                {error, Reason} ->
+                    {ok, Resp1} = chttpd:send_delayed_error(Resp0, Reason),
+                    {stop, Acc#vacc{resp = Resp1}}
+            end
     end;
 all_dbs_info_callback(complete, #vacc{resp = Resp0} = Acc) ->
     {ok, Resp1} = chttpd:send_delayed_chunk(Resp0, "]"),