summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2013-01-27 23:49:38 +0100
committerJan Lehnardt <jan@apache.org>2013-01-27 23:49:57 +0100
commit734ca24858c1fdcaa9d998f19bbf7f3e35817f64 (patch)
treeabd9d94d7b4c666e0c660ddca177a7d3621bfe0a
parent09d6787efdd40f7dd10dbb34cf80a9d88e1af502 (diff)
downloadcouchdb-734ca24858c1fdcaa9d998f19bbf7f3e35817f64.tar.gz
fix multipart response mixup, fixes replication.js
-rw-r--r--src/couchdb/couch_doc.erl14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl
index 0c7b2d9cb..39e235484 100644
--- a/src/couchdb/couch_doc.erl
+++ b/src/couchdb/couch_doc.erl
@@ -461,14 +461,14 @@ len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, SendEncodedAtts) ->
AccAttsSize +
4 + % "\r\n\r\n"
case SendEncodedAtts of
- false ->
+ true ->
% header
- length(integer_to_list(DiskLen)) +
- DiskLen;
+ length(integer_to_list(AttLen)) +
+ AttLen;
_ ->
% header
- length(integer_to_list(AttLen)) +
- AttLen
+ length(integer_to_list(DiskLen)) +
+ DiskLen
end +
4 + % "\r\n--"
size(Boundary) +
@@ -533,8 +533,8 @@ atts_to_mp([Att | RestAtts], Boundary, WriteFun,
% write headers
LengthBin = case SendEncodedAtts of
- true -> list_to_binary(integer_to_list(DiskLen));
- false -> list_to_binary(integer_to_list(AttLen))
+ true -> list_to_binary(integer_to_list(AttLen));
+ false -> list_to_binary(integer_to_list(DiskLen))
end,
WriteFun(<<"\r\nContent-Disposition: attachment; filename=\"", Name/binary, "\"">>),
WriteFun(<<"\r\nContent-Type: ", Type/binary>>),