From e6b6131134271d29d9cf3071b949eb2f84bb1a74 Mon Sep 17 00:00:00 2001 From: Hikari Date: Fri, 20 Feb 2026 19:45:37 -0800 Subject: [PATCH] fix: allow static assets to be served correctly Fixed the not-found handler to exclude /assets routes, allowing static assets like images to be served with correct MIME types instead of being caught by the SPA fallback handler. Changes: - Updated setNotFoundHandler to check for /assets prefix - Assets are now served directly by fastify-static with correct content-type - Only non-API, non-asset routes fall through to index.html This fixes the default cover image not displaying because it was being served as text/html instead of image/jpeg. Co-Authored-By: Naomi Carrigan --- api/src/app/plugins/static.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/app/plugins/static.ts b/api/src/app/plugins/static.ts index 08f5ec5..06dbd98 100644 --- a/api/src/app/plugins/static.ts +++ b/api/src/app/plugins/static.ts @@ -21,8 +21,8 @@ export default async function staticPlugin(app: FastifyInstance) { // Catch-all route for Angular SPA routing (must be registered after API routes) app.setNotFoundHandler((request, reply) => { - // Only catch routes that don't start with /api - if (!request.url.startsWith("/api")) { + // Only catch routes that don't start with /api or /assets + if (!request.url.startsWith("/api") && !request.url.startsWith("/assets")) { reply.sendFile("index.html"); } else { reply.code(404).send({ error: "Not Found" });