mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 17:28:55 +00:00
Fix anime covers display
This commit is contained in:
@@ -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}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user