[object Object]

← back to Wallco Ai

api/room: fall back to IMG_DIR/basename when local_path (often a Mac2 abs path) is missing on prod — fixes 'design file missing on disk' on the See-in-Room generate flow

7a10d3df63dd2f1ea846783231b7e3e4f9891d5c · 2026-05-31 16:02:12 -0700 · Steve Abrams

Files touched

Diff

commit 7a10d3df63dd2f1ea846783231b7e3e4f9891d5c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun May 31 16:02:12 2026 -0700

    api/room: fall back to IMG_DIR/basename when local_path (often a Mac2 abs path) is missing on prod — fixes 'design file missing on disk' on the See-in-Room generate flow
---
 server.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server.js b/server.js
index 7917f33..fab0b24 100644
--- a/server.js
+++ b/server.js
@@ -19790,6 +19790,14 @@ app.post('/api/room', async (req, res) => {
     designWidthIn  = designWidthIn  || Number(d.width_in)  || null;
     designHeightIn = designHeightIn || Number(d.height_in) || null;
   }
+  // Prod local_path is often a Mac2 absolute path (/Users/stevestudio2/...) that
+  // doesn't exist on this box, while the SAME file lives at IMG_DIR/<basename>
+  // (data/generated). Fall back to that before declaring it missing — fixes the
+  // "design file missing on disk" error on the admin See-in-Room generate flow
+  // (2026-05-31). Same basename-resolution the by-id image handler already uses.
+  if (file && !fs.existsSync(file)) {
+    try { const alt = path.join(IMG_DIR, path.basename(file)); if (fs.existsSync(alt)) file = alt; } catch (e) {}
+  }
   if (!file || !fs.existsSync(file)) {
     return res.status(404).json({ ok: false, error: 'design file missing on disk', file });
   }

← f8d5453 designer-studio: un-gate /api/studio/elements (public vocab,  ·  back to Wallco Ai  ·  Publish drunk-animals batch 8 (39400-39404) — SQL-direct, se 9b1e458 →