couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikewall...@apache.org
Subject [03/13] couch-replicator commit: updated refs/heads/2707-merge-couch_replicator-fixes-from-cloudant-fork to 367562b
Date Tue, 02 Jun 2015 17:29:10 GMT
Verify that url really points to a database

This is a cherry-pick of:

https://github.com/cloudant/couch_replicator/commit/e73714196936c345d54158e674ab36cab20beeec


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/74da56e5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/74da56e5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/74da56e5

Branch: refs/heads/2707-merge-couch_replicator-fixes-from-cloudant-fork
Commit: 74da56e5d396a7bc739c1ebb50e6d98a52dac858
Parents: 2e6d5c1
Author: Robert Newson <rnewson@apache.org>
Authored: Wed Dec 3 11:41:48 2014 +0000
Committer: Mike Wallace <mikewallace@apache.org>
Committed: Tue Jun 2 17:43:33 2015 +0100

----------------------------------------------------------------------
 src/couch_replicator_api_wrap.erl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/74da56e5/src/couch_replicator_api_wrap.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_api_wrap.erl b/src/couch_replicator_api_wrap.erl
index 504a3d1..ef38c73 100644
--- a/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator_api_wrap.erl
@@ -83,9 +83,16 @@ db_open(#httpdb{} = Db1, _Options, Create) ->
                     ok
                 end)
         end,
-        send_req(Db, [{method, head}],
-            fun(200, _, _) ->
-                {ok, Db};
+        send_req(Db, [{method, get}],
+            fun(200, _, {Props}) ->
+                case get_value(<<"update_seq">>, Props) of
+                    undefined ->
+                        throw({db_not_found, ?l2b(db_uri(Db))});
+                    _ ->
+                        {ok, Db}
+                end;
+            (200, _, _Body) ->
+                 throw({db_not_found, ?l2b(db_uri(Db))});
             (401, _, _) ->
                 throw({unauthorized, ?l2b(db_uri(Db))});
             (_, _, _) ->


Mime
View raw message