{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/react-router/issues/313","repository_url":"https://api.github.com/repos/reactjs/react-router","labels_url":"https://api.github.com/repos/reactjs/react-router/issues/313/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-router/issues/313/comments","events_url":"https://api.github.com/repos/reactjs/react-router/issues/313/events","html_url":"https://github.com/reactjs/react-router/issues/313","id":43748676,"number":313,"title":"improper routing when the param contains a slash","user":{"login":"ztmr","id":1504424,"avatar_url":"https://avatars.githubusercontent.com/u/1504424?v=3","gravatar_id":"","url":"https://api.github.com/users/ztmr","html_url":"https://github.com/ztmr","followers_url":"https://api.github.com/users/ztmr/followers","following_url":"https://api.github.com/users/ztmr/following{/other_user}","gists_url":"https://api.github.com/users/ztmr/gists{/gist_id}","starred_url":"https://api.github.com/users/ztmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ztmr/subscriptions","organizations_url":"https://api.github.com/users/ztmr/orgs","repos_url":"https://api.github.com/users/ztmr/repos","events_url":"https://api.github.com/users/ztmr/events{/privacy}","received_events_url":"https://api.github.com/users/ztmr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/reactjs/react-router/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2014-09-24T10:28:26Z","updated_at":"2016-06-30T20:44:04Z","closed_at":"2014-10-08T02:39:45Z","body":"Let `item/:id` be a route and `item.id` a key used to lookup the item in a database. If the `item.id` contains special characters barring the slash, the URL is being generated correctly. If the `item.id` contains one or more slashes `/`, none of them is escaped and causes routing issues -- especially when there is another route of `item/:id/...`.\r\n\r\nI have experimented with the following:\r\n```\r\n--- Path.js     2014-09-24 12:17:32.944015842 +0200\r\n+++ Path.js.new 2014-09-24 12:16:51.104016891 +0200\r\n@@ -52,7 +52,7 @@\r\n     }\r\n \r\n     var compiled = compilePattern(pattern);\r\n-    var match = URL.decode(path).match(compiled.matcher);\r\n+    var match = path.split('/').map(URL.decode).join('/').match(compiled.matcher);\r\n \r\n     if (!match)\r\n       return null;\r\n@@ -97,7 +97,7 @@\r\n       );\r\n \r\n       // Preserve forward slashes.\r\n-      return String(params[paramName]).split('/').map(URL.encode).join('/');\r\n+      return URL.encode (params[paramName]);\r\n     });\r\n   },\r\n```\r\n...but there is still regex that matches params, so I stopped hacking the project and started to ask why the hell somebody took so much of the special care to preserve the slashes in the parameters.\r\n\r\nIn general, we don't use slashes in object identifiers but we're currently doing migration of some ancient data where the slash sometimes appear in the object id and it is not feasible to remove it across all the object references. Also, doing extra param encoding/decoding when passing it to the link and withdrawing it from the target component properties would work, but it is a serious nuisance.\r\n\r\nIs there any special reason for keeping the original behavior? Can we work it out somehow?"},"comment":{"url":"https://api.github.com/repos/reactjs/react-router/issues/comments/229783151","html_url":"https://github.com/reactjs/react-router/issues/313#issuecomment-229783151","issue_url":"https://api.github.com/repos/reactjs/react-router/issues/313","id":229783151,"user":{"login":"coolblabla","id":19633223,"avatar_url":"https://avatars.githubusercontent.com/u/19633223?v=3","gravatar_id":"","url":"https://api.github.com/users/coolblabla","html_url":"https://github.com/coolblabla","followers_url":"https://api.github.com/users/coolblabla/followers","following_url":"https://api.github.com/users/coolblabla/following{/other_user}","gists_url":"https://api.github.com/users/coolblabla/gists{/gist_id}","starred_url":"https://api.github.com/users/coolblabla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coolblabla/subscriptions","organizations_url":"https://api.github.com/users/coolblabla/orgs","repos_url":"https://api.github.com/users/coolblabla/repos","events_url":"https://api.github.com/users/coolblabla/events{/privacy}","received_events_url":"https://api.github.com/users/coolblabla/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T20:44:04Z","updated_at":"2016-06-30T20:44:04Z","body":"+1"}}
{"actor":{"display_login":"coolblabla"}}