iCloud-API
iCloud-API copied to clipboard
Note with missing shortGUID is not handled
When a note that has no shortGUID field is passed to Notes.resolve(...), the iCloud will respond with a HTTP 400, the response payload of which is not handled in Notes.resolve(), leading to a follow-up error (see #51 )
Invalid data in a note should be handled before submitting the resolve request to the server.
Where exactely in a note object is this shortGUID field located? I can't find it. Thanks a lot!
It's directly below the note object; this is my workaround:
notes.on("end", async zone => {
if (notes.folders.length > 0) {
var folders = notes.folders.filter(f => !f.recordName.startsWith("TrashFolder"));
folders.forEach(async folder => {
createFolderDir(folder.recordName);
folder.notes
.filter(n => n.shortGUID)
.map(note => myCloud.Notes
.resolve(note)
.then(pv => pv.forEach(pve => saveNote(pve))
)
);
});
}
});