From 538f455f2e2842d5caa33ed300d28b3cd52599b3 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sun, 9 Nov 2008 22:39:26 +0000 Subject: apply replication fixing patches from COUCHDB-157 git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@712578 13f79535-47bb-0310-9956-ffa450edef68 --- THANKS | 1 + share/www/script/couch_tests.js | 11 +++++++++++ src/couchdb/couch_rep.erl | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/THANKS b/THANKS index 0f6b8bd4..2b8b5011 100644 --- a/THANKS +++ b/THANKS @@ -14,6 +14,7 @@ Some of these people are: * Michael Gottesman * Michael Hendricks * Till Klampaeckel + * Adam Kocoloski * Roger Leigh * Jim Lindley * Sam Ruby diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index ccb9755d..2553df9b 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -1615,6 +1615,17 @@ var tests = { T(docA._rev == docB._rev); } + // check documents with a '/' in the ID + // need to re-encode the slash when replicating from a remote source + dbA.save({ _id:"abc/def", val:"one" }); + + T(CouchDB.replicate(A, B).ok); + T(CouchDB.replicate(B, A).ok); + + docA = dbA.open("abc/def"); + docB = dbB.open("abc/def"); + T(docA._rev == docB._rev); + // now check binary attachments var binDoc = { _id:"bin_doc", diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl index 2eb59ddb..c91364c8 100644 --- a/src/couchdb/couch_rep.erl +++ b/src/couchdb/couch_rep.erl @@ -343,7 +343,7 @@ open_doc_revs(DbUrl, DocId, Revs, Options) when is_list(DbUrl) -> "latest=true" end, Options), RevsQueryStrs = lists:flatten(?JSON_ENCODE(Revs)), - Url = DbUrl ++ binary_to_list(DocId) ++ "?" ++ couch_util:implode(["revs=true", "attachments=true", "open_revs=" ++ RevsQueryStrs ] ++ QueryOptionStrs, "&"), + Url = DbUrl ++ url_encode(DocId) ++ "?" ++ couch_util:implode(["revs=true", "attachments=true", "open_revs=" ++ RevsQueryStrs ] ++ QueryOptionStrs, "&"), JsonResults = do_http_request(Url, get, []), Results = lists:map( -- cgit v1.2.3