Fix - Allow properly-formatted path parameters to work (also fixes URL::to('/')'s output) #395
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fix allows properly-formatted path parameters (those beginning with a slash; e.g. "/path/to/page") to be used, without breaking past compatibility by still allowing ("path/to/page") to work. These path parameters are used in methods such as URL::to('/page'), Redirect::to('/page'), etc.
Also, because of how this change is done, it fixes an issue where the root site path was being output incorrectly by URL::to. URL::to('/') used to output
http://domain.com
(without a trailing slash), but now outputshttp://domain.com/
as it should for the root URL.So with this we can use:
Redirect::to('/')
Redirect::to('/about')
(this now works)Redirect::to('about')
(the old way still works)URL::to('/')
-http://domain.com/
(now has the trailing slash for the root!)URL::to('/path/to/page')
-http://domain.com/path/to/page
(this now works)URL::to('path/to/page')
-http://domain.com/path/to/page
(the old way still works)