delvedor / find-my-way

A crazy fast HTTP router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug - parameter separator logic bug when path end with variable params

aofong19871029 opened this issue · comments

There are two urls
/h5/:cityName-:poiName/hotels-c:cityId-r:poiId
/h5/:cityName-:poiName/hotels-c:cityId-a:poiId

The different part are the first letter of "r:poiId" and "a:poiId"
Under normal circumstances, the two URLs above should not be recognized as two different URLs.

However find-my-way identify two urls have same pattern /h5/()/hotels-c() and then throw `Method 'get' already declared for route '/h5/()/hotels-c().' with constraints '{}'

After studied and debugged the source code and thought the problem should be in L246
In line246 if the route is end with variable, find-my-way omissions the static part between two variable.

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.