Avoid badmatch when replicator dbnames have leading slashes.

Closes COUCHDB-317

Patch by Joan Touzet.
diff --git a/script/test/replication.js b/script/test/replication.js
index 2b23af5..fd60dd4 100644
--- a/script/test/replication.js
+++ b/script/test/replication.js
@@ -497,6 +497,15 @@
   } 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");