diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index 75340be..aac5378 100644 --- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php @@ -55,7 +55,7 @@ protected static function getUriAsDisplayableString($uri) { $uri_reference = explode(':', $uri, 2)[1]; // @todo Present the leading slash to the user and hence delete the next // block in https://www.drupal.org/node/2418017. There, we will also - // remove the ability to enter '' or '', well expect '/' + // remove the ability to enter '' or '', we will expect '/' // and '' instead respectively. $path = parse_url($uri, PHP_URL_PATH); if ($path === '/') { diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 93bd846..c4ae390 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -1998,7 +1998,8 @@ public function renderMoreLink() { if ($this->getOption('link_display') == 'custom_url' && $override_path = $this->getOption('link_url')) { $tokens = $this->getArgumentsTokens(); $path = $this->viewsTokenReplace($override_path, $tokens); - $url = Url::fromUri('user-path:/' . $path); + // @todo Views should expect the leading slash; followup issue. + $url = Url::fromUserInput('/' . $path); } // Otherwise, use the URL for the display. else { diff --git a/core/modules/views/src/Plugin/views/row/RssFields.php b/core/modules/views/src/Plugin/views/row/RssFields.php index 82b1212..10ed129 100644 --- a/core/modules/views/src/Plugin/views/row/RssFields.php +++ b/core/modules/views/src/Plugin/views/row/RssFields.php @@ -144,7 +144,9 @@ public function render($row) { // Create the RSS item object. $item = new \stdClass(); $item->title = $this->getField($row_index, $this->options['title_field']); - $item->link = Url::fromUri('user-path:/' . $this->getField($row_index, $this->options['link_field']))->setAbsolute()->toString(); + // @todo Is this actually user input? If so, Views should expect a leading + // slash (followup). + $item->link = Url::fromUserInput('/' . $this->getField($row_index, $this->options['link_field']))->setAbsolute()->toString(); $item->description = $this->getField($row_index, $this->options['description_field']); $item->elements = array( array('key' => 'pubDate', 'value' => $this->getField($row_index, $this->options['date_field'])), @@ -158,7 +160,9 @@ public function render($row) { $item_guid = $this->getField($row_index, $this->options['guid_field_options']['guid_field']); if ($this->options['guid_field_options']['guid_field_is_permalink']) { $guid_is_permalink_string = 'true'; - $item_guid = Url::fromUri('user-path:/' . $item_guid)->setAbsolute()->toString(); + // @todo Is this actually user input? If so, Views should expect a leading + // slash (followup). + $item_guid = Url::fromUserInput('/' . $item_guid)->setAbsolute()->toString(); } $item->elements[] = array( 'key' => 'guid', diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index dca6e3c..69f6f96 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -336,7 +336,8 @@ function template_preprocess_views_view_summary(&$variables) { $base_path = $argument->options['summary_options']['base_path']; $tokens = $this->getArgumentsTokens(); $base_path = $this->viewsTokenReplace($base_path, $tokens); - $url = Url::fromUri('user-path:/' . $base_path); + // @todo Views should expect a leading /. Needs followup issue. + $url = Url::fromUserInput('/' . $base_path); } else { $url = $view->getUrl($args)->setOptions($url_options); @@ -405,7 +406,7 @@ function template_preprocess_views_view_summary_unformatted(&$variables) { $base_path = $argument->options['summary_options']['base_path']; $tokens = $this->getArgumentsTokens(); $base_path = $this->viewsTokenReplace($base_path, $tokens); - $url = Url::fromUri('user-path:/' . $base_path); + $url = Url::fromUri('/' . $base_path); } else { $url = $view->getUrl($args)->setOptions($url_options); @@ -914,8 +915,12 @@ function template_preprocess_views_view_rss(&$variables) { // Compare the link to the default home page; if it's the default home page, // just use $base_url. + // $todo The above comment seems out of date; also, this seems way messy. + // Views should expect a leadig slash, but why are we doing our own + // reverse-engineering for the front page route? And is this really user + // input? $url_string = $url->setOptions($url_options)->toString(); - if ($url_string === Url::fromUri('user-path:/' . $config->get('page.front'))->toString()) { + if ($url_string === Url::fromUserInput('/' . $config->get('page.front'))->toString()) { $url_string = Url::fromRoute('')->setAbsolute()->toString(); }