Skip to content

Incorrect Matches #12

Description

@edalorzo

Hello there,

Thanks for the library. I've been playing with it for around an hour now, trying to see if I can make it work for my use case.
I believe I found a case that seems to contradict the specification.

You see, the specification under section 2.3.8 Form-Style Query Expansion: {?var} contains the following examples:

Example Template     Expansion

       {?who}             ?who=fred
       {?half}            ?half=50%25
       {?x,y}             ?x=1024&y=768
       {?x,y,empty}       ?x=1024&y=768&empty=
       {?x,y,undef}       ?x=1024&y=768
       {?var:3}           ?var=val
       {?list}            ?list=red,green,blue
       {?list*}           ?list=red&list=green&list=blue
       {?keys}            ?keys=semi,%3B,dot,.,comma,%2C
       {?keys*}           ?semi=%3B&dot=.&comma=%2C

It appears that {?keys*} should match any key=value attributes, not just an attribute named key.

So, the problem is that this does not work:

link := "https://www.target.com/tracking/1ZY853E7YN84847119?ref=10"
t := tmpl.MustNew("https://www.target.com/tracking/{trackingNumber}{?keys*}")
match := t.Match(link)
if match == nil {
  println("Nothing found")
}

The thing is that I can't get a match when I don't care about the query params. I wish I could specify query params can be empty or can be anything, and I don't care.

Maybe I misunderstood the specification, but otherwise, this is an invalid mismatch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions