I’m using Couchbase Lite on a mobile ionic framework project. I create a photo from the device camera in a base64 data URL. I put that into a document _attachments property and it works great on Android when I PUT the doc into CouchBase, but gives a Bad Data Encoding error on iOS.
doc is a JSON object.
doc._attachments = {
"inPhoto" : {
content_type : "image/jpeg",
data : imageData // base64 encoded jpeg image from device camera shot.
}
}
query = encodeURI(COUCHBASEURL + dbName + SLASH + docId + '?rev=' + doc._rev);
$http.put(query, doc).success(function(data, status, headers, config) {
success(data, status, headers, config);
}).error(function(data, status, headers, config) {
fail(data, status, headers, config);
});
Hits the fail() line with the error: BAD DATA ENCODING
Anyone else seen this or know what might be going on?