Skip to content

A self-hosted media server and file management system

fix: preview generator job

aminnausin0c6dbc1ba62c
diff --git a/app/Services/PreviewGeneratorService.php b/app/Services/PreviewGeneratorService.php
index 2d5aea2d..d296c207 100644
--- a/app/Services/PreviewGeneratorService.php
+++ b/app/Services/PreviewGeneratorService.php
@@ -20,7 +20,8 @@ class PreviewGeneratorService {
public function __construct(
protected PathResolverService $pathResolver,
protected FileJobService $fileJobService,
- ) {}
+ ) {
+ }
public function handle(Request $request): Response {
$defaultData = $this->defaultData($request);
@@ -103,7 +104,7 @@ class PreviewGeneratorService {
'thumbnail_url' => $thumbnail,
'upload_date' => $this->formatDate($folderResource->series->date_created),
'content_string' => $contentString,
- 'tags' => $folderResource->series->folder_tags ? array_map(fn ($tag) => $tag->name, $folderResource->series->folder_tags) : null,
+ 'tags' => $folderResource->series->folder_tags ? array_map(fn($tag) => $tag->name, $folderResource->series->folder_tags) : null,
'url' => $request->fullUrl(),
];
@@ -133,7 +134,7 @@ class PreviewGeneratorService {
'release_date' => $releaseDate,
'upload_date' => $this->formatDate($video->metadata->date_uploaded),
'mime_type' => $video->mime_type,
- 'tags' => $videoResource->video_tags ? array_map(fn ($tag) => $tag->name, $videoResource->video_tags) : null,
+ 'tags' => $videoResource->video_tags ? array_map(fn($tag) => $tag->name, $videoResource->video_tags) : null,
'studio' => ucfirst($folderResource?->series?->studio),
'url' => $request->fullUrl(),
];
@@ -194,14 +195,15 @@ class PreviewGeneratorService {
} catch (\Throwable $th) { // Cannot catch the specific spatie/image exception since it throws a generic one
$message = $th->getMessage();
if ($message !== 'The spatie/image package is required to perform image manipulations. Please install it by running `composer require spatie/image`') {
- Log::warning('Error during OG image generation', ['error' => $th->getMessage()]);
+ Log::error('Error during OG image generation', ['error' => $th->getMessage(), 'trace' => $th->getTraceAsString()]);
}
+
if (file_exists($tempPath)) {
$imageContents = file_get_contents($tempPath);
Storage::disk('public')->delete($tempRelativePath);
}
- if (! $selfStore || ! $imageContents) {
+ if (! $selfStore || ! isset($imageContents)) {
return $imageContents ?? false;
}
diff --git a/storage/app/.gitignore b/storage/app/.gitignore
index cf2db893..8b936095 100755
--- a/storage/app/.gitignore
+++ b/storage/app/.gitignore
@@ -1,3 +1,4 @@
!private/
!public/
!.gitignore
+chrome