diff -u b/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php b/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php --- b/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php +++ b/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php @@ -48,10 +48,11 @@ if (strpos($path, '/' . $directory_path . '/styles/') === 0) { $path_prefix = '/' . $directory_path . '/styles/'; } - // In case of private file's image style also handle situation when the - // language code is prefixed to the path. - elseif (preg_match('|^(/[a-z]{2}[\-a-z]*)?/system/files/styles/|', $path, $matches)) { - $path_prefix = $matches[0]; + // Check if the string '/system/files/styles/' exists inside the path, + // that means we have a case of private file's image style. + elseif (strpos($path, '/system/files/styles/') !== FALSE) { + $path_prefix = '/system/files/styles/'; + $path = substr($path, strpos($path, $path_prefix), strlen($path)); } else { return $path;