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

Stringify of values with double and single quotes can create invalid results #48

Closed
quintesse opened this issue Nov 22, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@quintesse
Copy link

This object when passed through stringify():

{ "x": "{\"module\":\"database\",\"props\":{\"databaseType\":\"postgresql\"},\"extra\":{},\"foo\":\"bar'\"}" }

Will result in the following (invalid) output:

x: "{\"module\":\"database\",\"props\":{\"databaseType\":\"postgresql\"},\"extra\\
  ":{},\"foo\":\"bar'\"}

Remove the single quote from the "bar" at the end and everything will stringify okay.

@eemeli eemeli added the bug Something isn't working label Nov 22, 2018
@eemeli
Copy link
Owner

eemeli commented Nov 22, 2018

That looks like an off-by-one error in the double-quoted string stringifier; the \ escape of the first " on the second line gets incorrectly left on the preceding line. I'll take a look at fixing this as soon as I can. Alternatively, I'd be very willing to accept a PR for this.

@eemeli eemeli closed this as completed in d462f04 Nov 28, 2018
@quintesse
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants