-
-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Labels
Description
Hi,
I am not sure if I am doing something wrong or there is a bug which causes this behaviour. I took your demo code and added a new document via the "addItem" function which worked fine. A new document was added to my bucket and the attachment too. Then I wrote the following function to check the response of "getBlob":
getItem() {
let document = this.db.getDocument("8a5349ce-9693-44aa-a636-5e6a2c4c48e1");
console.log('document', document);
let blob = this.db.getBlob("8a5349ce-9693-44aa-a636-5e6a2c4c48e1","image");
console.log('blob',blob);
}
The output of the console.log:
JS: document {
JS: "id": "8a5349ce-9693-44aa-a636-5e6a2c4c48e1",
JS: "revisionID": "2-929ca4eb1b2c4def2b458614a805b687af5f5287",
JS: "title": "",
JS: "created_at": "2021-05-17T13:04:51.043Z",
JS: "image": null
JS: }
JS: blob {}
After this I checked the function "getBlob" in index.android.js of the plugin and added there a console.log too to check if the object there is empty too:
getBlob(id, name) {
let document = this.android.getDocument(id);
if (!document)
return null;
const blob = document.getBlob(name);
console.log('blob', blob);
if (!blob)
return null;
return new Blob(blob);
}
The output was:
JS: blob Blob{@0x908ca92,type=image/png,len=5109}
And now I am confused if there is a bug in the plugin or I am doing something wrong.
Metadata
Metadata
Assignees
Labels
Projects
Milestone
Relationships
Development
Select code repository
Activity
triniwiz commentedon May 18, 2021
So the document returns a json string that I parse to improve performance but I have some ideas how to fix that
Itzme83 commentedon May 18, 2021
Sounds good to me. Thank you! I will test the behavior in the current version with iOS tomorrow (I am from Germany and its kinda late here now) and post here the results.
Also there is a compatibility problem with the Couchbase Sync Gateway if you are using the public API from outside the Couchbase Lite universe for example via cURL to add attachments (see this forum post for more informations: https://forums.couchbase.com/t/attachment-with-couchbaselite-attachment-v-s-syncgateway-admin-api-attachment/26007/6)
Would be nice to have this compatibility :-)
triniwiz commentedon May 18, 2021
Nice will try adding that
Itzme83 commentedon May 19, 2021
So I tested now the behaviour with iOS and it is similar to Android. The output of the console.log in my "getItem" function is:
And in index.ios.js:
Jonathan64340 commentedon Mar 13, 2024
[EDIT][RESOLVED] Hello, i have the same issue.
With Android all work fine, but with iOS i get {} on return of the function getBlob(id, name);
The details of code here
How can i fix them ?
Thank you.
I'd been resolved my issue by changing this followings things :