Files
buzz-sheet/app/api/comments/images/[id]/route.ts
T
gunshiz 5812d99715
CI / Verify (push) Successful in 2m30s
CI / Build immutable images and deploy (push) Successful in 3m9s
feat : comment feature
2026-10-08 01:40:08 +07:00

14 lines
669 B
TypeScript

import { commentImage, getCommentViewer } from "@/lib/comments/repository";
import { publicMediaUrl } from "@/lib/media/storage";
import { errorResponse } from "@/lib/security/http";
export async function GET(_request: Request, context: { params: Promise<{ id: string }> }) {
try {
const image = await commentImage((await context.params).id, await getCommentViewer());
// Keep old attachment links working without proxying image bytes through the app.
return new Response(null, { status: 307, headers: {
Location: publicMediaUrl(image.objectKey), "Cache-Control": "private, no-store",
} });
} catch (cause) { return errorResponse(cause); }
}