- Issue created by @DamienMcKenna
- 🇺🇸United States DamienMcKenna NH, USA
For consideration:
diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index d16ef550651..b3a8e0e0d41 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -276,6 +276,11 @@ public static function fromUserInput($user_input, $options = []) { * @see \Drupal\Core\Url::fromUserInput() */ public static function fromUri($uri, $options = []) { + // Special handling for <nolink>. + if ($uri == '<nolink>') { + return Url::fromRoute('<nolink>'); + } + // parse_url() incorrectly parses base:number/... as hostname:port/... // and not the scheme. Prevent that by prefixing the path with a slash. if (preg_match('/^base:\d/', $uri)) {
- First commit to issue fork.
- 🇺🇸United States dcam
I don't know why it thinks I made an MR. It is not my intention to work on this issue.
I did look at this page earlier. This isn't the first time D.o has randomly opened MRs on my behalf after I've glanced at an issue.
- 🇺🇸United States smustgrave
No worries @dcam happens all the time.
Am moving back to NW as there should be an MR and test
- 🇺🇸United States DamienMcKenna NH, USA
Is this the correct approach or are there other considerations or appraoches to fixing this that I didn't take into account?
- First commit to issue fork.
- Merge request !11734Issue #3516258: Cannot use <nolink> in link fields in default content → (Open) created by Unnamed author
- First commit to issue fork.
- 🇧🇷Brazil charlliequadros
Using DDEV, follow the steps below to verify if the issue has been resolved:
Run the command: ddev drush php
Enter the following code:
$url = \Drupal\Core\Url::fromUri('internal:<nolink>');
The expected behavior is that no errors are thrown.
- 🇺🇸United States smustgrave
1) Drupal\Tests\Core\UrlTest::testFromRoutedPathWithNolinkRoute InvalidArgumentException: The URI '<nolink>' is invalid. You must use a valid URI scheme. /builds/issue/drupal-3516258/core/lib/Drupal/Core/Url.php:293 /builds/issue/drupal-3516258/core/tests/Drupal/Tests/Core/UrlTest.php:220 ERRORS!
Removing test tag, rest seems fine too