Attachments in a P2P push replication from iOS to Android

iOS -> iOS is working fine but when trying iOS -> Android, there seem to be an issue with the MIME body.
See the last line of the iOS -> Android logs.

iOS -> iOS

14:52:49.704‖ SyncVerbose: CBLMultipartDocumentReader[_id="(null)"]: has attachments, multipart/related; boundary="BE74265D-EA91-4E72-9012-C656345A6010"

14:52:49.706‖ SyncVerbose: CBLMultipartDocumentReader[_id="9177F8B0-21BA-4DFB-9C70-1E0DA287574E"]: Starting attachment #1...

14:52:49.712‖ SyncVerbose: CBLMultipartDocumentReader[_id="9177F8B0-21BA-4DFB-9C70-1E0DA287574E"]: Finished attachment #1: len=992k, digest=md5-pb4Bsi5wJVh5g31FK7oxzg==, SHA1=<9d5ca469 0d090388 94ef2a14 a13e0068 7d282e7a>

14:52:49.712‖ SyncVerbose: CBLMultipartDocumentReader[_id="9177F8B0-21BA-4DFB-9C70-1E0DA287574E"]: Finished loading (1 attachments)

Android -> iOS

14:51:20.892‖ SyncVerbose: CBLMultipartDocumentReader[_id="(null)"]: has attachments, multipart/related; boundary=OalAA-wjlkk89YgRsqIqIyIHVGk5Q2xMpV

14:51:20.892‖ SyncVerbose: CBLMultipartDocumentReader[_id="3ca1940f-6e96-4522-9b55-d6c54d7ea8c5"]: Starting attachment #1...

14:51:20.894‖ SyncVerbose: CBLMultipartDocumentReader[_id="3ca1940f-6e96-4522-9b55-d6c54d7ea8c5"]: Finished attachment #1: len=172k, digest=md5-XWjbA9IQHHJ/tzKADJB87A==, SHA1=<8eda6ee2 fda825ab fe7a59af d91afd4e 7548d84a>

14:51:20.894‖ SyncVerbose: CBLMultipartDocumentReader[_id="3ca1940f-6e96-4522-9b55-d6c54d7ea8c5"]: Finished loading (1 attachments)

14:51:20.894‖ WARNING: CBLMultipartDocumentReader[_id="3ca1940f-6e96-4522-9b55-d6c54d7ea8c5"]: Attachment 'photo' does not appear in a MIME body

I’m not sure what the MIME body is referencing to?

In the Android app, I’m saving attachments like so:

for (Parcelable path : uris) {

        Bitmap image = BitmapFactory.decodeFile(path.toString());

            Document document = database.createDocument();
            UnsavedRevision revision = document.createRevision();

            ByteArrayOutputStream out = new ByteArrayOutputStream();
            image.compress(Bitmap.CompressFormat.JPEG, 50, out);
            ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());

            revision.setAttachment("photo", "application/octet-stream", in);

            try {
            } catch (CouchbaseLiteException e) {

I think the warning means that the MD5 computed by the iOS CBL_BlobStoreWriter when reading the attachment and the MD5 in JSON document’s attachment properties received from Android are not the same. Not sure there is anything related to gzip attachment or not. I looked at the code and iOS doesn’t expect gzip attachment.

Just check java code (master) and java doesn’t send gzip’s attachment as well so it’s not the gzip related issue.

@jamiltz, did you try to send the same image? From the log, the size of the 2 images are quite different.