Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / image / src / PathProcessor / PathProcessorImageStyles.php
index 5fdbd2f5eca2c782a015b7d035122dbf672598c8..f40d083ac4824d8358a90e52a8cf283688d6461b 100644 (file)
@@ -48,8 +48,11 @@ class PathProcessorImageStyles implements InboundPathProcessorInterface {
     if (strpos($path, '/' . $directory_path . '/styles/') === 0) {
       $path_prefix = '/' . $directory_path . '/styles/';
     }
-    elseif (strpos($path, '/system/files/styles/') === 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;