schneespur/release/schneespur-1.0.2/app/Http/Controllers/StorageFallbackController.php
Michael 7288b93500 Release v1.0.2: diagnostic infrastructure core
Add neutral diagnostic framework for future reporting modules:
- DiagnosticReporterInterface, Registry, Manager, PayloadSanitizer
- Laravel exception hook in bootstrap/app.php
- Module permission declarations (requires_permissions in module.json)
- Core diagnostic report points (module boot/install/update failures)
- Module documentation update (moduldoku.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-18 16:54:11 +00:00

27 lines
731 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\Response;
class StorageFallbackController extends Controller
{
public function __invoke(string $path): Response
{
$disk = Storage::disk('public');
if (! $disk->exists($path)) {
abort(404);
}
$mimeType = $disk->mimeType($path) ?: 'application/octet-stream';
$lastModified = $disk->lastModified($path);
return response($disk->get($path), 200, [
'Content-Type' => $mimeType,
'Cache-Control' => 'public, max-age=604800',
'Last-Modified' => gmdate('D, d M Y H:i:s', $lastModified) . ' GMT',
]);
}
}