couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [2/2] git commit: Avoid badmatch when replicator dbnames have leading slashes.
Date Sat, 26 Jan 2013 17:28:08 GMT
Updated Branches:
  refs/heads/1.3.x 6b560f7e3 -> 7fa217b7e
  refs/heads/master 93f58e8ad -> 5d92ae8fa


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/7fa217b7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/7fa217b7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/7fa217b7

Branch: refs/heads/1.3.x
Commit: 7fa217b7e69de4c3684bc7fa98542b4c5a8660b3
Parents: 6b560f7
Author: Jan Lehnardt <jan@apache.org>
Authored: Sat Jan 26 18:14:42 2013 +0100
Committer: Jan Lehnardt <jan@apache.org>
Committed: Sat Jan 26 18:27:59 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/7fa217b7/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 <fedor@indutny.com>
  * Tim Blair
  * Tady Walsh <hello@tady.me>
+ * Joan Touzet <joant@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/7fa217b7/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/7fa217b7/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 ->


Mime
View raw message