Problem/Motivation
Part of #2407505: [meta] Finalize the menu links (and other user-entered paths) system. As part of #2411333: Create standard logic to handle a entity: URI scheme and #2412509: Change LinkItem.uri to type 'uri' rather than 'string' and introduce user-path: scheme, we are adding support for entity: and user-path: schemes to unify the storage of internal paths to valid URIs. The // are not used with these schemes because this is actually in violation of the spec and incompatible with PHP's parse_url() function. (See #2407505-39: [meta] Finalize the menu links (and other user-entered paths) system for details.) base:// is invalid for the same reason.
Proposed resolution
Convert Url::fromUri() base:// scheme (used for base-relative non-routes, e.g. /robots.txt) to base:.
Remaining tasks
Patch in progress.
Either as part of this issue or as a followup (depending on other work related to the meta), we should also re-evaluate the uses of base: and identify which of them should perhaps be user-path: from #2412509: Change LinkItem.uri to type 'uri' rather than 'string' and introduce user-path: scheme instead. Additionally, all uses of base: in core should probably have a comment justifying their use (vs. other schemes or methods).
User interface changes
None.
API changes
Url::fromUri() now requires base: instead of base:// for base-relative paths.
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | interdiff-unbreak.txt | 1.29 KB | xjm |
| #26 | routing-2416763-26.patch | 53.23 KB | xjm |
| #24 | interdiff-HEAD.txt | 1.49 KB | xjm |
| #23 | routing-2416763-23.patch | 53.23 KB | xjm |
| #20 | interdiff-15-20.txt | 1.14 KB | xjm |
Comments
Comment #1
xjmStarter patch with a couple @todos. Some of these uses of
base:are suspect, but many of them will be removed in #2412509: Change LinkItem.uri to type 'uri' rather than 'string' and introduce user-path: scheme.Comment #2
xjmComment #4
wim leersOnly one failure!
Perhaps slightly out of scope, but "should be prepended with base:" is kind of strange, "should use the base: scheme" would be better.
AFAIK: yes.
Comment #5
xjmSo the test failure is because we have an assertion that relies on
base://not being a relevant scheme:Edit: Which is checking:
in PathPluginBase::validatePath().
which was introduced to resolve the random failure #2353347: Random failure in DisplayPathTest which in turn was introduced by the original change. I wonder if we can remove this assertion?
Comment #6
xjmAh, yep, we can remove the assertion. The exact reason it was introduced was:
Thrown in:
Comment #7
xjmUpdated for #2411333: Create standard logic to handle a entity: URI scheme and removed the assertion per #6.
Comment #9
xjmLess reroll fail. Good night moon.
Comment #10
xjmSo a followup from #6, I think if we remove that assertion, we actually need to add an assertion in the Url tests that it is valid. Same possibly for the note elsewhere in the path about colons. Working on that and the other @todo.
Comment #11
xjmFiled #2417459: Provide internal API for special schemes and thin public wrappers for user input and non-routed URLs.
Comment #12
xjmNeeds mega reroll followup #2350837: Convert most usages of EntityInterface::getSystemPath() to use routes.
Comment #13
xjmAlright, that was fun.
Attached:
base:, including the one from the removed Views test.I've also attached two
-do-not-test.patch, one that contains only the//removals (review withgit diff --color-words) and one that includes all the changes after that (for easier rerolling next time).Comment #14
xjmOops, I meant to move this back out into its own method. Will do that shortly.
Comment #15
yesct commenteddoes not apply. things moving fast today.
Comment #16
xjmNeeded a reroll again already. Also addresses #14.
Comment #18
wim leerseffulgentsia and I reviewed this; we only found a nitpick and some minor missing test coverage. Once that's fixed, we think it's RTBC.
Nit:
===These test schemeless URIs with respectively a fragment, a path + querystring, querystring and path.
We also want to test one with a leading slash and one with a double leading slash (scheme-relative).
Comment #19
yesct commented(please do not retest #16)
#2417549: Drupal\migrate_drupal\Tests\d6\MigrateFileTest fail in MigrateTestBase
Comment #20
xjmAddresses #18.
Comment #21
xjmJust to clarify, I have reproduced #19 only once out of dozens of test runs, so I've postponed that issue on it happening again and assuming #20 passes as expected we should be good here.
Comment #22
wim leersRTBC per #18.
Comment #23
xjmUpdated for #2412509: Change LinkItem.uri to type 'uri' rather than 'string' and introduce user-path: scheme.
Comment #24
xjmComment #25
xjmUnit test failure.
Comment #26
xjmComment #27
wim leerseffulgentsia and I reviewed the interdiffs; this is RTBC if it comes back green :)
Comment #29
webchickGettin' this one in while it's hot!
Committed and pushed to 8.0.x. Thanks!