[object Object]

← back to Wpb Sales Dashboard

fix: static send() JSON-stringified Buffers → serve raw bytes

3a526d7934313c63d67a0fef1a05334f870dc356 · 2026-07-08 12:07:16 -0700 · Steve

Files touched

Diff

commit 3a526d7934313c63d67a0fef1a05334f870dc356
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Jul 8 12:07:16 2026 -0700

    fix: static send() JSON-stringified Buffers → serve raw bytes
---
 server.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/server.js b/server.js
index df6afd6..81d1764 100644
--- a/server.js
+++ b/server.js
@@ -195,6 +195,7 @@ function checkAuth(req) {
 }
 function send(res, code, body, type) {
   res.writeHead(code, { 'Content-Type': type || 'application/json', 'Cache-Control': 'no-store' });
+  if (Buffer.isBuffer(body)) return res.end(body);           // static files: pass raw bytes, don't JSON-stringify
   res.end(typeof body === 'string' ? body : JSON.stringify(body));
 }
 function readBody(req) {

← 1b8b830 initial scaffold: WPB sales & products dashboard (:9812)  ·  back to Wpb Sales Dashboard  ·  add secured idempotent /webhook/sale receiver + .env loader cf0832c →