skipper icon indicating copy to clipboard operation
skipper copied to clipboard

eskip parsing of string literals is different than expected

Open NorthFury opened this issue 6 years ago • 4 comments

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 avatar Mar 02 '18 14:03 NorthFury

@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.

szuecs avatar Mar 02 '18 15:03 szuecs

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.

NorthFury avatar Mar 02 '18 16:03 NorthFury

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

aryszka avatar Mar 15 '18 20:03 aryszka

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.

aryszka avatar May 28 '19 11:05 aryszka