I have a component that uses /node/:id for the path, and also has some redirects setup for certain paths like: /node/16.
While using 0.5.3, if I have a redirect setup for /node/16 to "test/url" and then I try to access /node/165 nothing will ever load. The url is being checked by CanonicalRecognizer.getCanonicalUrl() and by using the indexOf function on line 1516 the url of /node/165 is triggering a match and being rewritten to /test/url5 (the /node/16 being the rewritten part).
My change was to have the else if statement check for exact equality instead of relying on indexOf:
line 1516 - router.es5.js 0.5.3:
- } else if (url.indexOf(fromUrl) === 0) {
+ } else if (url === fromUrl) {
I haven't run into any negative side effects from this change, and now /node/165 will load correctly while still allowing /node/16 to be rewritten.
I have a component that uses /node/:id for the path, and also has some redirects setup for certain paths like: /node/16.
While using 0.5.3, if I have a redirect setup for /node/16 to "test/url" and then I try to access /node/165 nothing will ever load. The url is being checked by CanonicalRecognizer.getCanonicalUrl() and by using the indexOf function on line 1516 the url of /node/165 is triggering a match and being rewritten to /test/url5 (the /node/16 being the rewritten part).
My change was to have the else if statement check for exact equality instead of relying on indexOf:
I haven't run into any negative side effects from this change, and now /node/165 will load correctly while still allowing /node/16 to be rewritten.
Hope this can be helpful for other people.