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
The server produces invalid json for a settings get request if the raw setting text includes a value allowed by JSON5, but not by JSON (such as Infinity)
Reproduce
Add a user-level setting, such as Notebook.numberCellsToRenderDirectly, and set it to Infinity. This is a value that is allowed by JSON5, but is not allowed by JSON. Then start JupyterLab and note the many errors in the console about not being able to parse the results of the settings request.
Basically, this line adds converts the JSON5 raw setting to JSON:
It does a pretty good job of stripping comments, etc, but it leaves in the Infinity. Python can serialize Infinity just fine, but the browser chokes on the response, giving an error like JSON.parse: unexpected character at line 1 column 25047 of the JSON data
Since we've standardized on JSON5, I think perhaps we should not try to include a parsed version of the setting. Instead, just send the raw text over and do a json5 conversion in the browser.
Expected behavior
Infinity to be properly recognized by the setting system.
Context
Operating System and version: macOS Catalina
Browser and version: Firefox 92
JupyterLab version: 3.2 unreleased master
The text was updated successfully, but these errors were encountered:
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋
I responded on the PR, but copying it here too. I think it would be better if the server did not send nonstandard JSON at all (for example, it could send the setting just as raw text to be interpreted as JSON5 on the frontend). If we send nonstandard JSON in response to a settings request, it breaks the expectation of the rest api that the response is valid JSON.
Description
The server produces invalid json for a settings get request if the raw setting text includes a value allowed by JSON5, but not by JSON (such as Infinity)
Reproduce
Add a user-level setting, such as Notebook.numberCellsToRenderDirectly, and set it to Infinity. This is a value that is allowed by JSON5, but is not allowed by JSON. Then start JupyterLab and note the many errors in the console about not being able to parse the results of the settings request.
Basically, this line adds converts the JSON5 raw setting to JSON:
jupyterlab_server/jupyterlab_server/settings_utils.py
Line 89 in f286ddf
It does a pretty good job of stripping comments, etc, but it leaves in the Infinity. Python can serialize Infinity just fine, but the browser chokes on the response, giving an error like
JSON.parse: unexpected character at line 1 column 25047 of the JSON data
Since we've standardized on JSON5, I think perhaps we should not try to include a parsed version of the setting. Instead, just send the raw text over and do a json5 conversion in the browser.
Expected behavior
Infinity to be properly recognized by the setting system.
Context
The text was updated successfully, but these errors were encountered: