public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl
index d991de2..4f5d19d 100644
--- a/src/couchdb/couch_doc.erl
+++ b/src/couchdb/couch_doc.erl
@@ -458,15 +458,17 @@ len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, SendEncodedAtts) ->
_ ->
AccAttsSize +
4 + % "\r\n\r\n"
- case SendEncodedAtts of
- true ->
- % header
- length(integer_to_list(AttLen)) +
- AttLen;
- _ ->
- % header
+ case {Encoding, SendEncodedAtts} of
+ {identity, _} ->
+ % stored and served in identity form
length(integer_to_list(DiskLen)) +
- DiskLen
+ DiskLen;
+ {_, false} when DiskLen =/= AttLen->
+ length(integer_to_list(DiskLen)) +
+ DiskLen;
+ {_, true} ->
+ length(integer_to_list(AttLen)) +
+ AttLen
end +
4 + % "\r\n--"
size(Boundary) +

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.