summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/www/script/test/replication.js16
-rw-r--r--src/couchdb/couch_rep.erl2
2 files changed, 11 insertions, 7 deletions
diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js
index 56698c59..d76d2fd8 100644
--- a/share/www/script/test/replication.js
+++ b/share/www/script/test/replication.js
@@ -144,7 +144,7 @@ couchTests.replication = function(debug) {
dbA.save({
_id:"bin_doc",
_attachments:{
- "foo.txt": {
+ "foo+bar.txt": {
"type":"base64",
"data": "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ="
}
@@ -154,7 +154,7 @@ couchTests.replication = function(debug) {
dbA.save({
_id:"_design/with_bin",
_attachments:{
- "foo.txt": {
+ "foo+bar.txt": {
"type":"base64",
"data": "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ="
}
@@ -163,17 +163,21 @@ couchTests.replication = function(debug) {
};
this.afterAB1 = function(dbA, dbB) {
- var xhr = CouchDB.request("GET", "/test_suite_db_a/bin_doc/foo.txt");
+ var xhr = CouchDB.request("GET",
+ "/test_suite_db_a/bin_doc/foo%2Bbar.txt");
T(xhr.responseText == "This is a base64 encoded text")
- xhr = CouchDB.request("GET", "/test_suite_db_b/bin_doc/foo.txt");
+ xhr = CouchDB.request("GET",
+ "/test_suite_db_b/bin_doc/foo%2Bbar.txt");
T(xhr.responseText == "This is a base64 encoded text")
// and the design-doc
- xhr = CouchDB.request("GET", "/test_suite_db_a/_design/with_bin/foo.txt");
+ xhr = CouchDB.request("GET",
+ "/test_suite_db_a/_design/with_bin/foo%2Bbar.txt");
T(xhr.responseText == "This is a base64 encoded text")
- xhr = CouchDB.request("GET", "/test_suite_db_b/_design/with_bin/foo.txt");
+ xhr = CouchDB.request("GET",
+ "/test_suite_db_b/_design/with_bin/foo%2Bbar.txt");
T(xhr.responseText == "This is a base64 encoded text")
};
},
diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl
index afb947e7..9d100d1f 100644
--- a/src/couchdb/couch_rep.erl
+++ b/src/couchdb/couch_rep.erl
@@ -372,7 +372,7 @@ attachment_loop(ReqId) ->
attachment_stub_converter(DbS, Id, {Name, {stub, Type, Length}}) ->
#http_db{uri=DbUrl, headers=Headers} = DbS,
% TODO worry about revisions
- Url = DbUrl ++ url_encode(Id) ++ "/" ++ ?b2l(Name),
+ Url = DbUrl ++ url_encode(Id) ++ "/" ++ url_encode(?b2l(Name)),
?LOG_DEBUG("Attachment URL ~p", [Url]),
{ok, RcvFun} = make_attachment_stub_receiver(Url, Headers, Name,
Type, Length),