delvedor / find-my-way

A crazy fast HTTP router
MIT License
1.46k stars 133 forks source link

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

Open aofong19871029 opened 4 months ago

aofong19871029 commented 4 months ago

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.

mcollina commented 4 months ago

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.