import { readBrandingFile } from "@/lib/branding"; const CONTENT_TYPES: Record = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", webp: "image/webp", svg: "image/svg+xml", ico: "image/x-icon", gif: "image/gif", }; export async function GET( request: Request, { params }: { params: Promise<{ filename: string }> } ) { const { filename } = await params; const data = await readBrandingFile(filename); if (!data) return new Response("Not found", { status: 404 }); const ext = filename.split(".").pop()?.toLowerCase() ?? ""; const contentType = CONTENT_TYPES[ext] ?? "application/octet-stream"; return new Response(new Uint8Array(data), { headers: { "Content-Type": contentType, // Dateinamen tragen bereits einen Date.now()-Suffix, ein neuer // Upload bekommt also automatisch einen neuen Namen. "Cache-Control": "public, max-age=31536000, immutable", }, }); }