Single quote interpolation escape is matching across JSON messages
samhh opened this issue · 1 comments
Given:
{
"x": { "message": "a'" },
"y": { "message": "'b" }
}
We should parse x
and y
as plaintext. We actually parse x
alone with a message spanning the contents of both x
and y
sans single quotes because said single quotes are parsing as an interpolation escape, breaking out of the bounds of the message parser.
This is the cause of the issues with intlc 0.4.0 in Unsplash web.
The ideal fix will be to prevent the message parser from escaping the bounds of the JSON message. The quick hack fix is to disable single quote interpolation escaping as I don't think we're using it anywhere.
Doesn't affect callbacks:
{
"x": { "message": "a<f>" },
"y": { "message": "</f>b" }
}
Gives errors on each callback tag as expected.
Probably caused by all manyTill
in the ICU parser using token
, except for escaped
which uses charLiteral
.
Ideally we could reserve the characters the ICU parser can access before ever entering this module/parser. Seems like this isn't really feasible though: https://www.reddit.com/r/haskell/comments/q7ytoj/is_there_a_good_way_to_run_an_inner_parser_with/hgs73oh/
The ICU parser will need to in some way know about its callers.
Edit: Actually we're cheating a bit and using eom
for that. A bit JSON-centric.