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.
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.