Platform: Android
CBL: 2.6 CE
Saving a blob with ByteArrayInputStream which extends from InputStream
new Blob("image/jpeg", getPicture(bitmap)
// ...
public static ByteArrayInputStream getPicture(Bitmap bitmap) {
ByteArrayInputStream myByteArrayInputStream = new ByteArrayInputStream(// ...);
// ...
return myByteArrayInputStream;
}
an error is thrown at SG:
[INF] SyncMsg: c:[5b1db747] #39: Type:rev --> 400 Incorrect data sent for attachment with digest: sha1-lcJZ/lBqNbS23v0aIzI+LmSxwxA= Time:66.291689ms
and in Android Studio it’s logged as:
E/CouchbaseLite/REPLICATOR: {N8litecore4repl6PusherE#1} Got error response to rev '7JFlD2OEV7U2ZBYiBXCC20aEaIL2::khj8xbs2yw3n::item::b55bea1b804a' #4-23fae3d30ea8398c9750e39637d52618ac7a3068 (seq #545): HTTP 400 'Incorrect data sent for attachment with digest: sha1-lcJZ/lBqNbS23v0aIzI+LmSxwxA='
If I wrap the ByteArrayInputStream with org.apache.commons.io.IOUtils.toByteArray
there is no error and the blob is pushed up.
new Blob("image/jpeg", IOUtils.toByteArray(getPicture(bitmap))
Posted here as the issues tab was removed on Github.