mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-15 23:56:29 +03:00
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:
co-authored by
Claude Fable 5
parent
6ece0e588f
commit
d66782753c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user