-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Unquote function panics when an escape character exists in string. #295
Comments
There may be a bug, but your test case is not one. In this case: example := "'te\\st'" The Go parser is unquoting the example := `'te\\st'` |
Why would my example be wrong, I was unquoting text which is sometimes regex which is literally a |
The builtin unquote uses Go's unquoting rules, which doesn't support |
got ya, ok I understand! Thank you for responding. May I recommend an EscapeQuoted String property than, to maybe allow it to work out of the box? Thank you! |
I found a bug in the function "unquote" where if there is a "\" in the string it fails.
Here is an example of it broken.
I just pulled the unquote from the code to test it. I did this to fix it.
Basically, the issue is if the string starts with a
\
, it will error in "UnquoteChar" which is why I am skipping it and manually adding it. Not sure if this is the "Best" approach, but it gets the point around.It could also be fixed by replacing
\\
with\\\\
before processing.The text was updated successfully, but these errors were encountered: