diff --git a/app/Extensions/helper/helpers.php b/app/Extensions/helper/helpers.php index 64bdfe85c..ea7ad125d 100644 --- a/app/Extensions/helper/helpers.php +++ b/app/Extensions/helper/helpers.php @@ -507,7 +507,7 @@ if (! function_exists('getReleaseCover')) { } elseif (! empty($xxxinfo_id)) { $coverType = 'xxx'; $coverId = $xxxinfo_id; - } elseif (! empty($anidbid)) { + } elseif (! empty($anidbid) && $anidbid > 0) { $coverType = 'anime'; $coverId = $anidbid; } diff --git a/app/Http/Controllers/CoverController.php b/app/Http/Controllers/CoverController.php index a8a5dd151..17ac6a1c3 100644 --- a/app/Http/Controllers/CoverController.php +++ b/app/Http/Controllers/CoverController.php @@ -38,6 +38,20 @@ class CoverController extends Controller $filePath = storage_path("covers/{$type}/{$filename}"); } } elseif ($type === 'anime') { + // For anime, check if the ID is valid (must be > 0) + // Reject covers for anidbid <= 0 (failed processing, no match, etc.) + if (preg_match('/^(-?\d+)(?:-cover)?\.jpg$/', $filename, $matches)) { + $anidbid = (int) $matches[1]; + if ($anidbid <= 0) { + // Return placeholder for invalid IDs + $placeholderPath = public_path('assets/images/no-cover.png'); + if (file_exists($placeholderPath)) { + return response()->file($placeholderPath); + } + abort(404); + } + } + // For anime, try the requested filename first, then fall back to old format (without -cover) $filePath = storage_path("covers/{$type}/{$filename}"); diff --git a/resources/views/admin/anidb/edit.blade.php b/resources/views/admin/anidb/edit.blade.php index b804339d3..d63f6da65 100644 --- a/resources/views/admin/anidb/edit.blade.php +++ b/resources/views/admin/anidb/edit.blade.php @@ -125,8 +125,7 @@
 }})