Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashes as URL separator #58

Closed
pma opened this issue Mar 1, 2014 · 1 comment
Closed

Dashes as URL separator #58

pma opened this issue Mar 1, 2014 · 1 comment

Comments

@pma
Copy link
Contributor

pma commented Mar 1, 2014

The implementation of Phoenix.Router.Path.split will not allow using dashes in the value of a named parameter.

For example, this route:

get "/resource/:id", App.Controllers.Resource, :show

will not match http://localhost:4000/resource/75f6306d-a090-46f9-8b80-80fd57ec9a41

But if we define a route that will match http://localhost:4000/resource?id=75f6306d-a090-46f9-8b80-80fd57ec9a41

we'll have the UUID with dashes included available in conn.params["id"]

Maybe I'm missing something, but I think the two cases above should yield similar results and dashes should not be considered a URL separator in the split function.

@chrismccord
Copy link
Member

This is fixed on master. The caveat is routes such as get "users/profile-:id" are no longer supported after this change. We can support both cases by generating an additional match definition, but for now I'd like to support your use-case which is much more prevalent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants