Olivier Massot пре 7 месеци
родитељ
комит
b4878be3f7

+ 1 - 1
src/Service/File/Factory/ImageFactory.php

@@ -30,7 +30,7 @@ class ImageFactory
     public function createImageContent(File $file, string $filterName): void
     {
         $filters_options = $this->getCropFilterOptions($file->getConfig());
-        $path = $file->getPath();
+        $path = $file->getSlug();
         $this->createAndStore($path, $filterName, $filters_options);
     }
 

+ 7 - 2
src/Service/File/Storage/LocalStorage.php

@@ -96,7 +96,7 @@ class LocalStorage implements FileStorageInterface
     public function getImageUrl(File $file, string $size, bool $relativePath): string
     {
         $filterName = $this->getFilterFromSizeAndConfig($size, !empty($file->getConfig()));
-        $path = $file->getPath();
+        $path = $file->getSlug();
 
         if (!$this->cacheManager->isStored($path, $filterName)) {
             try {
@@ -191,7 +191,12 @@ class LocalStorage implements FileStorageInterface
             throw new \RuntimeException('File has no filename');
         }
 
-        $isNewFile = $file->getSlug() === null;
+        try {
+            $isNewFile = $file->getSlug() === null;
+        } catch (\Throwable) {
+            $isNewFile = true; // Catch case where slud has not been initialized
+        }
+
         if ($isNewFile) {
             // Try to get the Access owner from the organization_id and person_id
             $access = null;