skipper
skipper copied to clipboard
eskip parsing of string literals is different than expected
The only cases where the escape char is removed is when it precedes an escape char or a delimiter ("
, /
or `).
Here is the code location I'm referring to.
Examples:
"\."
gets parsed as \.
@NorthFury can you show what you tested as input and what was the result of your test and what you might want to see. Probably you are right, but I can not understand you.
Here is an example of a route that is currently valid:
one: HostRegexp("^one\.two$") -> <shunt>;
Here is what would be a correct definition (still valid in the current implementation):
one: HostRegexp("^one\\.two$") -> <shunt>;
What would be expected in a string literal is that the only characters following \
would be \
and "
. The Regexp literal has the same parsing model.
Fixing this would be a breaking change.
my understanding is:
"\\"
in eskip is parsed to "\\"
go internal, which is fine
"\."
in eskip is parsed to "\\."
go internal, which is wrong
i agree that this is a bug
another example where the parsing doesn't work as expected:
Path("/robots.txt") ->
setResponseHeader("Content-Type", "text/plain") ->
inlineContent("User-agent: *\r\nAllow: /graphql\r\nAllow: /graphql/*\r\nDisallow: /\r\n") ->
status(200) -> <shunt>
In the above route \r and \n sequences are used without unescaping.