Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Requesting contacts from PIM throwing JSON Parse Error #682

Open
Cisneiros opened this issue Oct 7, 2013 · 4 comments
Open

Requesting contacts from PIM throwing JSON Parse Error #682

Cisneiros opened this issue Oct 7, 2013 · 4 comments

Comments

@Cisneiros
Copy link

When requesting contacts from PIM using the "find" method, on some phones, it throws a SyntaxError: JSON Parse Error: Expected '}' (thrown by WebWorks itself, it does not even call the onFindError callback).

I've seen a similar error with extensions (issue #124), which throws the same error, and maybe this is related. I think it is some special character being returned by the Native extension that is causing this, but I cannot be sure, as I don't know which specific contact is causing this to happen (the phones it happen have hundreds or thousands of contacts).

@jeffheifetz
Copy link
Contributor

Can you confirm what version of WebWorks you are using?

@Cisneiros
Copy link
Author

Sorry for the Delay. I'm using the most recent one. 1.0.4.11. I've narrowed down which characters cause problems (by creating contacts with each unicode character until I got an error trying to fetch them).

The problem is if a contact's field contains a double-quote or a backslash. This is probably an escaping issue, as it can render the JSON invalid. For example, if the contact's name is Marry " Jane, the JSON would be

{
    first_name: "Mary " Jane",
    ...
}

The same happens when the name ends on a backslash, as it escapes the last double-quote. I tried to solve this by editing the extension, but I didn't manage to do it.

@Cisneiros
Copy link
Author

Confirming my expectations, this is what happens when I inject some arbitrary JSON on the Contact Name:

Editing contact:

img_00002278

The contact on the Address Book:

img_00002279

My WebWorks app that requests the contact and prints "givenName + familyName":

img_00002280

@Cisneiros
Copy link
Author

@jeffheifetz Any updates on this? :)

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

No branches or pull requests

2 participants