Skip to content
Snippets Groups Projects

3023322 - Contextual Links Style Update

7 unresolved threads
4 files
+ 186
3
Compare changes
  • Side-by-side
  • Inline
Files
4
  • 7105aa27
    Issue #3254553 by Leon Kessler, Berdir, Bladedu, cmlara:... · 7105aa27
    Alex Pott authored
    Issue #3254553 by Leon Kessler, Berdir, Bladedu, cmlara: FileUrlGenerator::generate() does not work with externally hosted files using stream wrappers
    
    (cherry picked from commit a6063207)
@@ -186,8 +186,18 @@ public function generate(string $uri): Url {
return Url::fromUri(urldecode($options['path']), $options);
}
elseif ($wrapper = $this->streamWrapperManager->getViaUri($uri)) {
// Attempt to return an external URL using the appropriate wrapper.
return Url::fromUri('base:' . $this->transformRelative(urldecode($wrapper->getExternalUrl()), FALSE));
$external_url = $wrapper->getExternalUrl();
$options = UrlHelper::parse($external_url);
// @todo Switch to dependency injected request_context service after
// https://www.drupal.org/project/drupal/issues/3256884 is fixed.
if (UrlHelper::externalIsLocal($external_url, \Drupal::service('router.request_context')->getCompleteBaseUrl())) {
// Attempt to return an external URL using the appropriate wrapper.
return Url::fromUri('base:' . $this->transformRelative(urldecode($options['path']), FALSE), $options);
}
else {
return Url::fromUri(urldecode($options['path']), $options);
}
}
throw new InvalidStreamWrapperException();
}
Loading