millermedeiros / crossroads.js

JavaScript Routes
http://millermedeiros.github.com/crossroads.js/
1.44k stars 156 forks source link

Non-encoded slashes (/) on query params choosing wrong pattern #142

Open arnavmaiti opened 8 years ago

arnavmaiti commented 8 years ago

We have 2 patterns that parses the URLs using crossroads:

crossroads.addRoute('/:seo_slug*:/{pageId}/{contextId}', null, 200);
crossroads.addRoute('/:seo_slug*:/{pageId}?{parameters}', null, 200);

This works fine for all the normal URL patterns. However for query based patterns that uses unencoded slashes (/) in their URLs, it seems to choose the first pattern over the second one. For example

http://www.abc.com/#/abc?page=example/page/1

Although the second pattern should be chosen here, the first pattern is instead chosen and the data shows up as follows:

seo_slug = abc?page=example
pageId = page
contextId = 1