Conflict resolver don't sync blob

We work wtih cblite v2.7.1 and sync gateway 2.7.4 on an Android environment . After applying document custom conflict resolution, the document is sent without binary document/attachement, the document contains partial blob metadata but not the binary document/data itself.
However, if we update the document (set a field on it and save it), then the binary document is sent/synced with the server.
We need help.
Best regards

What is the behavior without custom conflict resolver? I don’t expect custom resolver having anything to do with the behavior that you are observing. Also, we will need logs on couchbase lite that describe what is going on.

In our mobile application, we have 2 user types that can change a document : the planner and the driver.
The driver can take some pictures offline. if the planner edits the document while the driver is offline, all pictures taken offline are lost. To fix this problem we need custom conflict resolution to merge data.
The custom conflict resolution functions almost correctly, because we have the meta data of the pictures taken offline in couchbase server, however,
the binary file itself is not uploaded to the server!

Last Friday, I take time to read code from com.couchbase.lite.AbstractDatabase in cblite and found the issue and fix it.

In com.couchbase.lite.AbstractDatabase, in method saveResolvedDocument, you miss to add HAS_ATTACHMENTS revision flags and them attachment isn’t taking for current revision.
How can I share the code ?

Best regards

I open a issue and PR for it

Best regards

Wow, @Giallon! Great catch! Will put that fix in any subsequent releases!

Thank you!

I am not going to accept that PR directly, because the code no longer looks quite like that.

I’ve filed the following bug to track the fix:


Your code, slightly modified, will be in the next release. We may backport it to patch versions of previous releases, as well.

Thanks a lot!

Thanks for fast answer @blake.meike.
I will try your fix to day.

Best regards

@blake.meike your change fixes the bug!

Best regards

That is very weird. Your testing is very appreciated.

If you look at the code, you will see that this can only happen in a really strange corner case. If you look at line 1333, you will see that we attempt to copy the flags from the resolved document. Either the c4Doc is null, or the call to getSelectedFlags is returning the wrong thing.

I am unable to repro this with a UT. If you have code that can do it, I would love to have it.

Thanks again for chasing this down.

Hi @blake.meike
In MutableDocument constructor, database and c4Doc argument are null.
I use MutableDocument to merge date between local and remote.

I hope that help you.

Thanks again
Best regards

Can I have the code, please? I’d very much appreciate that.

NVM. I have repro’d and have a test. Again, thanks for the help with this.