浏览代码

Merge pull request #5664 from hnrd/fix-migrate2cloud

Skip thumbnail cloud upload if no thumbnail exists
daniel 5 月之前
父节点
当前提交
92ce41ce18
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      app/Services/MediaStorageService.php

+ 4 - 2
app/Services/MediaStorageService.php

@@ -85,7 +85,9 @@ class MediaStorageService
     protected function localToCloud($media)
     {
         $path = storage_path('app/'.$media->media_path);
-        $thumb = storage_path('app/'.$media->thumbnail_path);
+        if ($media->thumbnail_path) {
+            $thumb = storage_path('app/'.$media->thumbnail_path);
+        }
 
         $p = explode('/', $media->media_path);
         $name = array_pop($p);
@@ -94,7 +96,7 @@ class MediaStorageService
         $storagePath = implode('/', $p);
 
         $url = ResilientMediaStorageService::store($storagePath, $path, $name);
-        if ($thumb) {
+        if ($media->thumbnail_path) {
             $thumbUrl = ResilientMediaStorageService::store($storagePath, $thumb, $thumbname);
             $media->thumbnail_url = $thumbUrl;
         }