-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix shared link hostname #5870
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 shared link hostname #5870
Conversation
|
| end | ||
|
|
||
| defp shared_link_dest(site, link) do | ||
| Routes.stats_path(PlausibleWeb.Endpoint, :shared_link, site.domain, auth: link.slug) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has the benefit of ensuring proper encoding even for auth query parameter, which Plausible.Sites.shared_link_url/2 doesn't actually do. We could make use of this same logic in Plausible.Sites.shared_link_url/2, but it didn't make sense to me when I considered the relation between the modules Routes / Plausible.Sites.
| test "doesn't share the same domain formatting with public dashboard links" do | ||
| site = new_site(domain: "a-café.fr") | ||
| link = insert(:shared_link, site: site) | ||
|
|
||
| assert "http://localhost:8000/a-café.fr" = PlausibleWeb.StatsView.pretty_stats_url(site) | ||
|
|
||
| assert "http://localhost:8000/share/a-caf%C3%A9.fr?" <> _q = | ||
| Sites.shared_link_url(site, link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This codifies current non-ideal behavior that I noticed. It's worth thinking about how to unify the two and all our other route utils as well.
* Fix missing share link hostname * Update changelog * Tests
Changes
Adds back the baseurl to shared links. It's needed for the links to be one-click shareable.
Tests
Changelog
Documentation
Dark mode