{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/router/issues/309","repository_url":"https://api.github.com/repos/aurelia/router","labels_url":"https://api.github.com/repos/aurelia/router/issues/309/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/router/issues/309/comments","events_url":"https://api.github.com/repos/aurelia/router/issues/309/events","html_url":"https://github.com/aurelia/router/issues/309","id":141004171,"number":309,"title":"URL encode results incorrect baseUrl of child router in Firefox","user":{"login":"balazsmeszegeto","id":1080428,"avatar_url":"https://avatars.githubusercontent.com/u/1080428?v=3","gravatar_id":"","url":"https://api.github.com/users/balazsmeszegeto","html_url":"https://github.com/balazsmeszegeto","followers_url":"https://api.github.com/users/balazsmeszegeto/followers","following_url":"https://api.github.com/users/balazsmeszegeto/following{/other_user}","gists_url":"https://api.github.com/users/balazsmeszegeto/gists{/gist_id}","starred_url":"https://api.github.com/users/balazsmeszegeto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balazsmeszegeto/subscriptions","organizations_url":"https://api.github.com/users/balazsmeszegeto/orgs","repos_url":"https://api.github.com/users/balazsmeszegeto/repos","events_url":"https://api.github.com/users/balazsmeszegeto/events{/privacy}","received_events_url":"https://api.github.com/users/balazsmeszegeto/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aurelia/router/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-03-15T15:17:36Z","updated_at":"2016-07-12T10:02:51Z","closed_at":"2016-07-05T20:08:13Z","body":"I have a router in app.js and then a child router, which has route-parameters.\r\nApp router config:\r\n`    config.map([\r\n      { route: 'child-route',  name: 'child', moduleId: 'child-router' }\r\n    ]);`\r\n\r\nChild router config:\r\n`\tconfig.map([\r\n      { route: 'my-route/p1/:param1/p2/:param2', name: 'my-route', moduleId: 'my-route' }\r\n    ]);`\r\n\r\nIf `:param1` or `:param2` contains non-URL characters (which has to be URL-encoded), then navigation fails in Firefox. Example of such URL is:\r\n`#/child-route/my-route/p1/foo bar/p2/foo bar baz` (non-URL character is _space_)\r\n\r\n_Reason:_\r\nUpon navigation, the baseUrl of the child-router gets recalculated (see `_refreshBaseUrl()`). The bug is in `getBaseUrl()` (navigation-instruction.js). In `getBaseUrl()`, the parent router's current instruction is checked and being \"subtracted\" from the fragment:\r\n`return this.fragment.substr(0, this.fragment.lastIndexOf(path));`.\r\n\r\nAt this point, fragment is URL-encoded (`#/child-route/my-route/p1/foo%20bar/p2/foo%20bar%20baz`), while path (which comes from `params`) is not (`/my-route/p1/foo bar/p2/foo bar baz`). Therefore, `substr` will return `\"\"`, which sets the baseUrl of the child router to `\"\"` instead of `\"/child-route/\"`. Thus AppRouter will try to load `#/my-route/p1/foo bar/p2/foo bar baz` (instead of `#child-route/my-route/p1/foo bar/p2/foo bar baz`), which results in \"Error: Route not found\".\r\n\r\nTested in v1.0.0-beta.1 and v1.0.0-beta.1.1.3. All other browsers work fine, the issue is only in Firefox.\r\n"},"comment":{"url":"https://api.github.com/repos/aurelia/router/issues/comments/231995045","html_url":"https://github.com/aurelia/router/issues/309#issuecomment-231995045","issue_url":"https://api.github.com/repos/aurelia/router/issues/309","id":231995045,"user":{"login":"balazsmeszegeto","id":1080428,"avatar_url":"https://avatars.githubusercontent.com/u/1080428?v=3","gravatar_id":"","url":"https://api.github.com/users/balazsmeszegeto","html_url":"https://github.com/balazsmeszegeto","followers_url":"https://api.github.com/users/balazsmeszegeto/followers","following_url":"https://api.github.com/users/balazsmeszegeto/following{/other_user}","gists_url":"https://api.github.com/users/balazsmeszegeto/gists{/gist_id}","starred_url":"https://api.github.com/users/balazsmeszegeto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balazsmeszegeto/subscriptions","organizations_url":"https://api.github.com/users/balazsmeszegeto/orgs","repos_url":"https://api.github.com/users/balazsmeszegeto/repos","events_url":"https://api.github.com/users/balazsmeszegeto/events{/privacy}","received_events_url":"https://api.github.com/users/balazsmeszegeto/received_events","type":"User","site_admin":false},"created_at":"2016-07-12T10:02:50Z","updated_at":"2016-07-12T10:02:50Z","body":"@EisenbergEffect I would be interested, but seems like you've already solved it (I was on vacation)"}}
{"actor":{"display_login":"balazsmeszegeto"}}