read($extension, $file); abort_if($stored === null, Response::HTTP_NOT_FOUND); return new Response($stored['contents'], Response::HTTP_OK, [ 'Content-Type' => $stored['mime'], 'Content-Disposition' => 'inline; filename="'.$file.'"', 'Cache-Control' => 'public, max-age=31536000, immutable', 'X-Content-Type-Options' => 'nosniff', // The type is fixed by the stored name and never sniffed; this keeps an // SVG opened directly from running script or loading anything. 'Content-Security-Policy' => "default-src 'none'; style-src 'unsafe-inline'; sandbox", ]); } }