Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So I noticed an error in SvelteKit load functions that were happening on page transitions (so the data is getting passed through
devalue
) when the data included a string coming from GitHub's API.The string in question was a long string of markdown, but the pertinent bit was a line like
- \x1DFix CSS handling
Lord knows why the
\x1D
sequence is in there, but it is.When that goes through devalue.stringify, that sequence ends up in the string as the raw
Group separator
character, which both JSON.parse and devalue.parse then choke on if you have to parse that string.I've got a JSFiddle with a minimal reproduction here
If you run that bit through JSON.stringify, that
\x1D
sequence gets escaped to\\u001d
, so it seems like if we extended the list of characters to escape that might cover it?Monkey patching
escaped
in a local install with'\x1D': '\\u001d'
got things rolling again.Seemed easy enough to do, so voila. Unless you think this is a bad idea?