Created
December 6, 2012 16:41
-
-
Save rnewson/4225901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment