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

add x1D group separator to escaped #50

Closed
wants to merge 1 commit into from

Conversation

leereamsnyder
Copy link

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?

@gtm-nayan
Copy link
Contributor

Superceded by #57

@leereamsnyder
Copy link
Author

That's a better fix. I'll close this.

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

Successfully merging this pull request may close these issues.

2 participants