Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note with missing shortGUID is not handled #52

Open
zudljk opened this issue Sep 5, 2020 · 2 comments
Open

Note with missing shortGUID is not handled #52

zudljk opened this issue Sep 5, 2020 · 2 comments

Comments

@zudljk
Copy link

zudljk commented Sep 5, 2020

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.

@JOJ0
Copy link

JOJ0 commented Oct 16, 2020

Where exactely in a note object is this shortGUID field located? I can't find it. Thanks a lot!

@zudljk
Copy link
Author

zudljk commented Nov 6, 2020

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))
                        )
                    );
            });
        }

      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants