Skip to content

Commit

Permalink
double slash check is now done in live_dashboard_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
cblavier committed Oct 26, 2023
1 parent 67f36e1 commit 7abb707
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/phoenix/live_dashboard/layout_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule Phoenix.LiveDashboard.LayoutView do
Phoenix.VerifiedRoutes.unverified_path(
conn,
conn.private.phoenix_router,
Path.join([prefix, "#{asset}-#{hash}"])
"#{prefix}/#{asset}-#{hash}"
)
else
apply(
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix/live_dashboard/page_builder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -982,9 +982,9 @@ defmodule Phoenix.LiveDashboard.PageBuilder do

path =
if node == node() and is_nil(old_params["node"]) do
Path.join([prefix, to_string(route)])
"#{prefix}/#{route}"
else
Path.join([prefix, URI.encode_www_form(to_string(node)), to_string(route)])
"#{prefix}/#{URI.encode_www_form(to_string(node))}/#{route}"
end

Phoenix.VerifiedRoutes.unverified_path(socket, socket.router, path, new_params)
Expand Down
4 changes: 3 additions & 1 deletion lib/phoenix/live_dashboard/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ defmodule Phoenix.LiveDashboard.Router do
unquote(scope)

unless Module.get_attribute(__MODULE__, :live_dashboard_prefix) do
@live_dashboard_prefix Phoenix.Router.scoped_path(__MODULE__, path)
@live_dashboard_prefix if path == "/",
do: "",
else: Phoenix.Router.scoped_path(__MODULE__, path)
def __live_dashboard_prefix__, do: @live_dashboard_prefix
end
end
Expand Down

0 comments on commit 7abb707

Please sign in to comment.