Peter Keller wrote:
> When PUTting a document with attachments in MIME multipart/related format,
> CouchDB (1.2.0 on Mac OS X) throws a badmatch error in
> doc_from_multi_part_stream() if any bytes are following the final boundary.
>
> For example, if the last body part ends with
>
> \r\n==1234==\r\nabc
>
> the error reads
>
> [error] [emulator] Error in process <0.18266.with exit value: {{badmatch,{<<7
> bytes>>,
> #Fun<couch_httpd_db.23.117176975>,ok}},[{couch_doc,'-doc_from_multi_part_stream/2-fun-1-',3,[{file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_doc.erl"},{line,512}]}]}
>
> where <<7 bytes>> is 2 + the number of bytes following the two ending hyphens
> (5 in this example). Everything works fine if the last body part ends with
> two hyphens only (i.e. the epilogue is left blank).
>
> However, according to RFC 1521 Sec. 7.2.1
> (<http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html>), "implementations
> should ignore anything that appears before the first boundary or after the
> last one".
I'd open a bug report: https://issues.apache.org/jira/browse/CouchDB
Nils.