serve-question: correct content-type for svg and gif heroes

The local-image map fell through to image/jpeg for anything that was
not webp or png, so an svg hero (the fake comp generator's native
format) silently failed to render on the decision page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-07-22 12:23:07 -07:00
co-authored by Claude Fable 5
parent 6ece0e588f
commit d66782753c
+5 -1
View File
@@ -550,7 +550,11 @@ const server = http.createServer((req, res) => {
if (imageMatch) {
const abs = localImages[Number(imageMatch[1])];
if (!abs) { res.writeHead(404); res.end(); return; }
const type = abs.endsWith('.webp') ? 'image/webp' : abs.endsWith('.png') ? 'image/png' : 'image/jpeg';
const type = abs.endsWith('.webp') ? 'image/webp'
: abs.endsWith('.png') ? 'image/png'
: abs.endsWith('.svg') ? 'image/svg+xml'
: abs.endsWith('.gif') ? 'image/gif'
: 'image/jpeg';
res.writeHead(200, { 'content-type': type });
fs.createReadStream(abs).pipe(res);
return;