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

Trim slashes between origin and optional first param #637

Merged
merged 3 commits into from
May 5, 2023

Conversation

bakerkretzmar
Copy link
Collaborator

This PR ensures that there is only ever exactly one slash (/) between a generated URL's origin and path. This fixes an issue where it was possible to end up with a double slash if the very first segment of the path is an optional, omitted, route parameter. For example, {locale?}/foo could generate domain.com//foo if the locale param wasn't provided.

Note: This PR intentionally does not change the behaviour of omitted optional route params inside the route path. It's still possible to get double slashes there, e.g. with something like /foo/{param?}/bar, but this matches the behaviour of Laravel's route() function.

Resolves the issue discussed in #616. See #616 (reply in thread).

@bakerkretzmar bakerkretzmar merged commit a0d4a28 into main May 5, 2023
@bakerkretzmar bakerkretzmar deleted the fix-optional-param-extra-slashes branch May 5, 2023 14:44
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.

1 participant