mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: resolve 5 Sentry production errors (668 total events)
- Filter known client-error noise (rate limit, empty body, unsupported media type, content-length mismatch, premature close) from Sentry via beforeSend to stop 644 events of non-actionable noise - Sanitize x-output-filename header to prevent TypeError on non-ASCII filenames in optimize-for-web preview (23 events) - Handle EPIPE on Python dispatcher stdin write with graceful fallback to per-request spawning instead of crashing (NODE-W) - Map EACCES on storage directory/file write to proper 503 status instead of generic 500 (NODE-P, 3 events)
This commit is contained in:
@@ -159,7 +159,8 @@ export function registerOptimizeForWeb(app: FastifyInstance) {
|
||||
reply.header("Content-Type", result.contentType);
|
||||
reply.header("X-Original-Size", String(fileBuffer.length));
|
||||
reply.header("X-Processed-Size", String(result.buffer.length));
|
||||
reply.header("X-Output-Filename", encodeURIComponent(result.filename));
|
||||
const safeFilename = encodeURIComponent(result.filename).replace(/[^ -~]/g, "");
|
||||
reply.header("X-Output-Filename", safeFilename);
|
||||
return reply.send(result.buffer);
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : "Preview processing failed";
|
||||
|
||||
Reference in New Issue
Block a user