You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.
Expand the folder for any Adobe CS application (e.g. Flash Builder 4, Illustrator CS5, etc.)
Results:
Folder does not expand. "Unexpected token" error is logged to JS console.
Expected:
Folder expands correctly, no error logged.
So here's what's going on: many applications' root folders contain a special file called "Icon\r" (where \r is an actual newline char). When readdir() calls the native method ReadDir() (ExecuteReadDir() in the ObjC source), it gets back JSON with a \r character inside a string literal, which is illegal syntax in JS, and thus its JSON.parse() call fails.
I think the root bug is actually in NSArrayToJSONString(), which should be escaping special characters in strings before spitting them out into the JSON source. We should probably put that functionality in a new utility function so that we can leverage it in other to-JSON conversions.
The text was updated successfully, but these errors were encountered:
As noted above, it should be pushed down into the central native method NSArrayToJSONString()
For completeness we should probably escape a few other characters, like ", , and maybe \t (even if these can't occur in Mac filenames, they'll probably arise in other circumstances eventually). (If we wanted to be really paranoid there's also \b, \f, and \v too).
Steps to repro:
Results:
Folder does not expand. "Unexpected token" error is logged to JS console.
Expected:
Folder expands correctly, no error logged.
So here's what's going on: many applications' root folders contain a special file called "Icon\r" (where \r is an actual newline char). When readdir() calls the native method ReadDir() (ExecuteReadDir() in the ObjC source), it gets back JSON with a \r character inside a string literal, which is illegal syntax in JS, and thus its JSON.parse() call fails.
I think the root bug is actually in NSArrayToJSONString(), which should be escaping special characters in strings before spitting them out into the JSON source. We should probably put that functionality in a new utility function so that we can leverage it in other to-JSON conversions.
The text was updated successfully, but these errors were encountered: