diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php index a0d7530c7d..5cfe1381bd 100644 --- a/core/modules/image/src/Entity/ImageStyle.php +++ b/core/modules/image/src/Entity/ImageStyle.php @@ -211,7 +211,10 @@ public function buildUrl($path, $clean_urls = NULL) { $stream_wrapper_manager = \Drupal::service('stream_wrapper_manager'); // The passed $path variable can be either a relative path or a full URI. - $original_uri = $stream_wrapper_manager::getScheme($path) ? $stream_wrapper_manager->normalizeUri($path) : file_build_uri($path); + if (!$stream_wrapper_manager::getScheme($path)) { + $path = \Drupal::config('system.file')->get('default_scheme') . '://' . $path; + } + $original_uri = $stream_wrapper_manager->normalizeUri($path); $token_query = [IMAGE_DERIVATIVE_TOKEN => $this->getPathToken($original_uri)]; if ($clean_urls === NULL) {