← back to Wallco Ai
fix(by-id-image): add IMG_DIR + basename(local_path) candidate
4781d583c62c7a32fa517c69e1880734d0e8624f · 2026-05-29 07:51:15 -0700 · Steve Abrams
When prod PG carries a Mac2-style absolute path (/Users/stevestudio2/.../
data/generated/X.png) the old resolution chain (lp1 -> local_path ->
quarantine) never tried IMG_DIR + basename. Result: cards with PUB
badges in admin curators rendered with blank images because the by-id
handler 404'd despite the PNG sitting on prod disk under the same
basename.
Surfaced 2026-05-29 on /admin/cactus-curator?category=drunk-animals:
prod PG had 90 drunk-animals as is_published=TRUE but Mac2 PG (source
of designs.json snapshot) had them as FALSE -> filtered out of DESIGNS
at boot -> PG fallback supplied Mac2 local_path -> 404. Now IMG_DIR +
basename hits, file serves. No regression on IDs already resolving.
Files touched
Diff
commit 4781d583c62c7a32fa517c69e1880734d0e8624f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Fri May 29 07:51:15 2026 -0700
fix(by-id-image): add IMG_DIR + basename(local_path) candidate
When prod PG carries a Mac2-style absolute path (/Users/stevestudio2/.../
data/generated/X.png) the old resolution chain (lp1 -> local_path ->
quarantine) never tried IMG_DIR + basename. Result: cards with PUB
badges in admin curators rendered with blank images because the by-id
handler 404'd despite the PNG sitting on prod disk under the same
basename.
Surfaced 2026-05-29 on /admin/cactus-curator?category=drunk-animals:
prod PG had 90 drunk-animals as is_published=TRUE but Mac2 PG (source
of designs.json snapshot) had them as FALSE -> filtered out of DESIGNS
at boot -> PG fallback supplied Mac2 local_path -> 404. Now IMG_DIR +
basename hits, file serves. No regression on IDs already resolving.
---
server.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/server.js b/server.js
index 1b7d24c..fef1157 100644
--- a/server.js
+++ b/server.js
@@ -2944,7 +2944,16 @@ app.get('/designs/img/by-id/:id', (req, res) => {
// Resolution chain (try in order):
// 1. localPathForDesign helper (PII-free filename → IMG_DIR/file)
// 2. d.local_path (DB column, may point at the original generated/ path)
- // 3. quarantine path (data/generated_ghost_quarantine/<basename>) — for
+ // 3. IMG_DIR + basename(d.local_path) — when PG carries a Mac2-style
+ // absolute path (/Users/stevestudio2/…/data/generated/X.png) that
+ // never exists on prod's filesystem. The PNG IS on prod under
+ // /root/public-projects/wallco-ai/data/generated/X.png — same basename,
+ // different prefix. Added 2026-05-29 after the drunk-animals curator
+ // surfaced 90 cards with PUB badges but blank images: prod PG had them
+ // published, Mac2 PG had them unpublished, so designs.json filtered them
+ // out of DESIGNS, the PG fallback supplied a Mac2 local_path, and the
+ // old chain (lp1 → local_path → quarantine) never derived the prod path.
+ // 4. quarantine path (data/generated_ghost_quarantine/<basename>) — for
// flagged designs that were soft-deleted via scripts/soft-delete-ghost-
// flagged.js; the PNG still exists, just moved.
const candidates = [];
@@ -2952,6 +2961,7 @@ app.get('/designs/img/by-id/:id', (req, res) => {
if (d.local_path) candidates.push(d.local_path);
if (d.local_path) {
const base = path.basename(d.local_path);
+ candidates.push(path.join(IMG_DIR, base));
candidates.push(path.join(__dirname, 'data', 'generated_ghost_quarantine', base));
}
if (process.env.BY_ID_DEBUG) console.log('[by-id]', id, 'candidates:', candidates.map(p => `${p} (${fs.existsSync(p) ? 'OK' : 'MISS'})`));
← 5c516fe feat(pdp): V11 Best-of composite — merge V1+V3+V9 strengths
·
back to Wallco Ai
·
fix(by-id-image): query all_designs not spoon_all_designs in 13587cd →