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 double slashes with domain params #754

Merged
merged 5 commits into from
May 16, 2024
Merged

Conversation

bakerkretzmar
Copy link
Collaborator

This PR fixes a bug where it was possible for a URL generated by Ziggy to have a double slash between the host and path if a) the route has a domain parameter, and b) the route path begins immediately with a route parameter (i.e. the parameter is at the root of the domain), and c) the route parameter value passed to the route() helper starts with a slash.

Note that we are intentionally leaving the double slash in the generated URL if it occurs later in the path, e.g. /catalog//p/test, because this is what Laravel does.

Investigating this issue highlighted some shortcomings in how we replace parameters, which I noted in comments, and uncovered an unrelated and more serious bug that I'll open an issue for shortly.

Closes #751.

@bakerkretzmar bakerkretzmar merged commit 617448b into 2.x May 16, 2024
16 checks passed
@bakerkretzmar bakerkretzmar deleted the fix-stripping-slashes-751 branch May 16, 2024 23:25
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.

Ziggy generates URL with a double leading slash
1 participant