Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
routing system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Sep 2014 at 01:00 UTC
Updated:
4 Oct 2014 at 08:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
larowlan@chx pointed out ltrim would be more efficient
Comment #2
chx commentedComment #3
larowlan/me tips hat to simplicity
Comment #6
Crell commentedQuite sensible. Thanks, larowlan!
Comment #7
dawehner+1
Comment #8
alexpottCommitted 966aed8 and pushed to 8.0.x. Thanks!
Comment #10
catchSorry I've reverted this, don't think it's the right change.
We validate against the leading slash to avoid storing a path with a leading slash in the database. That allows paths to be generated correctly on rendering. If a site moves in/out/between subdirectories then it would require a data migration to get the right path. I once worked on a site that had development installs in sub-directories but the main site at example.com/. Have also seen people run sites in a subdirectory alongside a legacy site, then move them up a level after a full migration.
Comment #11
dawehnerWell, for external URLs this doesn't matter. For internal URLs the path validator though actually stores the route name + parameters, so at render time you don't use the path any longer.
Comment #12
catchHmm that's a good point, although it doesn't cover the case from #2339219: [meta] Finalize URL generation API (naming, docs, deprecation) where the URL points to the same domain but it's not handled by Drupal. In that case we fail validation, but that discussion is covered in the other issue as to how that could be handled.
Realised I didn't push the revert, so just moving back to fixed.
Comment #13
Crell commentedMore to the point, the routing system uses a leading slash, always, from the front controller (index.php). We should be consistent with that elsewhere in code. We've not been. :-(
Comment #14
dawehner@Crell
The routing system does, but we have to present the URLs to the user.
Comment #15
chx commentedEdit: nevermind.