Initial commit: Animexe Laravel platform
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Support\MediaUrl;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class MediaController extends Controller
|
||||
{
|
||||
public function show(string $path)
|
||||
{
|
||||
$path = MediaUrl::normalize(rawurldecode($path));
|
||||
|
||||
abort_if($path === '' || str_contains($path, '..'), 404);
|
||||
|
||||
$disk = Storage::disk('public');
|
||||
|
||||
abort_unless($disk->exists($path), 404);
|
||||
|
||||
return response()->file($disk->path($path), [
|
||||
'Cache-Control' => 'public, max-age=31536000',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user