You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2013/01/26 18:21:22 UTC

git commit: Avoid badmatch when replicator dbnames have leading slashes.

Updated Branches:
  refs/heads/317-fix-replicator-slashes-in-db-names [created] 66327e648


Avoid badmatch when replicator dbnames have leading slashes.

Closes COUCHDB-317

Patch by Joan Touzet.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/66327e64
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/66327e64
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/66327e64

Branch: refs/heads/317-fix-replicator-slashes-in-db-names
Commit: 66327e648b4cda0476d82884c80b9563d9ceaa5f
Parents: 67e75c2
Author: Jan Lehnardt <ja...@apache.org>
Authored: Sat Jan 26 18:14:42 2013 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Sat Jan 26 18:21:04 2013 +0100

----------------------------------------------------------------------
 THANKS.in                                          |    1 +
 share/www/script/test/replication.js               |    9 +++++++++
 .../src/couch_replicator_api_wrap.erl              |    2 ++
 3 files changed, 12 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/66327e64/THANKS.in
----------------------------------------------------------------------
diff --git a/THANKS.in b/THANKS.in
index 4ebf3f0..ec0f8d3 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -94,6 +94,7 @@ suggesting improvements or submitting changes. Some of these people are:
  * Fedor Indutny <fe...@indutny.com>
  * Tim Blair
  * Tady Walsh <he...@tady.me>
+ * Joan Touzet <jo...@ieee.org>
 # Authors from commit 6c976bd and onwards are auto-inserted. If you are merging
 # a commit from a non-committer, you should not add an entry to this file. When
 # `bootstrap` is run, the actual THANKS file will be generated.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/66327e64/share/www/script/test/replication.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js
index 2b23af5..fd60dd4 100644
--- a/share/www/script/test/replication.js
+++ b/share/www/script/test/replication.js
@@ -497,6 +497,15 @@ couchTests.replication = function(debug) {
   } catch (x) {
     TEquals("db_not_found", x.error);
   }
+
+  // validate COUCHDB-317
+  try {
+    CouchDB.replicate("/foobar", "test_suite_db");
+    T(false, "should have failed with db_not_found error");
+  } catch (x) {
+    TEquals("db_not_found", x.error);
+  }
+
   try {
     CouchDB.replicate(CouchDB.protocol + host + "/foobar", "test_suite_db");
     T(false, "should have failed with db_not_found error");

http://git-wip-us.apache.org/repos/asf/couchdb/blob/66327e64/src/couch_replicator/src/couch_replicator_api_wrap.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index dcd6ca8..90cfa8e 100644
--- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
@@ -89,6 +89,8 @@ db_open(DbName, Options, Create) ->
             couch_db:create(DbName, Options)
         end,
         case couch_db:open(DbName, Options) of
+        {error, illegal_database_name, _} ->
+            throw({db_not_found, DbName});
         {not_found, _Reason} ->
             throw({db_not_found, DbName});
         {ok, _Db} = Success ->