Skip thumbnail cloud upload if no thumbnail exists

migrate2cloud fails on media without thumbnail.
fix check for existing thumbnail, skip upload if none exists.
This commit is contained in:
tercean 2025-02-03 00:46:26 +01:00
parent ad9a5f5a43
commit 3eb9257def

View file

@ -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;
}