Skip to content

Add non-catch-all version of dashboard route#6327

Merged
ukutaht merged 5 commits into
masterfrom
dashboard-link-trailing-slash-fix
May 11, 2026
Merged

Add non-catch-all version of dashboard route#6327
ukutaht merged 5 commits into
masterfrom
dashboard-link-trailing-slash-fix

Conversation

@ukutaht
Copy link
Copy Markdown
Contributor

@ukutaht ukutaht commented May 7, 2026

Currently dashboard links are generated with trailing slash across the application. This PR adds a route without the catch-all part which affects the router helpers so the link is generated without the trailing slash as shown here:

iex(6)> PlausibleWeb.Router.Helpers.stats_path(PlausibleWeb.Endpoint, :stats, "plausible.io", [])
"/plausible.io/"
iex(7)> r PlausibleWeb.Router
{:reloaded, [PlausibleWeb.Router, PlausibleWeb.Router.Helpers]}
iex(8)> PlausibleWeb.Router.Helpers.stats_path(PlausibleWeb.Endpoint, :stats, "plausible.io", [])
"/plausible.io"

The trailing slash appears in live demo stats, this is an attempt to suppress it.
Screenshot 2026-05-07 at 14 15 05

@ukutaht ukutaht requested a review from a team May 7, 2026 12:06
@ukutaht ukutaht added this pull request to the merge queue May 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 11, 2026
@ukutaht ukutaht added this pull request to the merge queue May 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 11, 2026
@ukutaht ukutaht added this pull request to the merge queue May 11, 2026
Merged via the queue into master with commit a08c881 May 11, 2026
38 of 40 checks passed
@ukutaht ukutaht deleted the dashboard-link-trailing-slash-fix branch May 11, 2026 09:22
@aerosol
Copy link
Copy Markdown
Member

aerosol commented May 11, 2026

Nice catch 😁
If only we could get rid of the trailing wildcard too... I recall it's what is preventing us from using compile time route helpers

@ukutaht
Copy link
Copy Markdown
Contributor Author

ukutaht commented May 11, 2026

If only we could get rid of the trailing wildcard too... I recall it's what is preventing us from using compile time route helpers

Yeah I think the problem is that with our routing structure any route is technically defined so the new verified routes would provide no validation at all. Like if we use this route:

~r"/blah/blah/foo/bar"

it would still match the router entry

get "/:dashboard/*path"

and pass the compile-time validation

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.

3 participants