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

Fix Phoenix.Controller.current_url #3392

Closed
wants to merge 2 commits into from

Conversation

radditude
Copy link

@radditude radditude commented May 2, 2019

There seems to be a small bug in the latest release - the current_url helper throws an undefined function error because it's trying to call ExampleWeb.Router.url\1 instead of ExampleWeb.Router.Helpers.url\1.

I've proposed a fix here using Module.concat. I've also updated the tests to use mock Endpoint and Router modules that more closely follow the structure of those found in Phoenix projects in order to prevent a recurrence.

Edit: forgot to include steps to repro the original bug:

  • Generate a new empty app using v1.4.4
  • Add a line to ExampleWeb.PageController.index:
    IO.inspect(current_url(conn))
  • Visit the page and see the error

Thanks for reading!

@chrismccord
Copy link
Member

Thanks for the report! We shouldn't need the Module.concat. Looks like it was introduced here cd1ce95

@josevalim can you take a look?

@chrismccord
Copy link
Member

Perhaps we meant to call endpoint_module instead of router_module. In that case, that should be the only change we need.

@josevalim
Copy link
Member

It is not the endpoint module. I will have to partially revert that commit.

@josevalim josevalim closed this in 1e40390 May 2, 2019
josevalim pushed a commit that referenced this pull request May 2, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants