[object Object]

← back to Atomic50 Onboard

atomic50 FIX 3: parse all_images as JSON array (jarr) instead of splitting on commas/whitespace, which shattered query-string URLs into un-parseable fragments; drop non-http entries

986f010a4f0413d4fa3b665f0ac0405e4b5e1f04 · 2026-07-13 15:13:13 -0700 · Steve

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files touched

Diff

commit 986f010a4f0413d4fa3b665f0ac0405e4b5e1f04
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 13 15:13:13 2026 -0700

    atomic50 FIX 3: parse all_images as JSON array (jarr) instead of splitting on commas/whitespace, which shattered query-string URLs into un-parseable fragments; drop non-http entries
    
    Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---
 build-snapshot.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/build-snapshot.js b/build-snapshot.js
index 556a322..e176dfa 100644
--- a/build-snapshot.js
+++ b/build-snapshot.js
@@ -69,10 +69,15 @@ function hueFromHex(hex) {
     const patterns = jarr(r.ai_patterns);
     // display name: pattern name is the mfr SKU (AT50-xx) for tiles; keep it — NEVER "Unknown"
     const name = r.pattern_name || r.mfr_sku || r.color_name || null;
+    // all_images is a jsonb-style array stored as TEXT (e.g. '["url1","url2"]').
+    // Parse it as JSON — NEVER split on commas/whitespace (that shatters URLs
+    // that contain query strings into un-parseable fragments). jarr() handles
+    // both a native array and a JSON-array string. Keep only clean http(s) URLs.
+    const isUrl = (u) => typeof u === 'string' && /^https?:\/\//i.test(u);
     const images = [];
-    if (r.image_url) images.push(r.image_url);
-    for (const im of String(r.all_images || '').split(/[|,\s]+/).filter(Boolean)) {
-      if (!images.includes(im)) images.push(im);
+    if (isUrl(r.image_url)) images.push(r.image_url);
+    for (const im of jarr(r.all_images)) {
+      if (isUrl(im) && !images.includes(im)) images.push(im);
     }
     return {
       handle: (r.mfr_sku || String(r.id)).toLowerCase().replace(/[^a-z0-9]+/g, '-'),

← 2e4914f atomic50 FIX 2: pin PORT fallback to 9942 (was 0 → random ep  ·  back to Atomic50 Onboard  ·  atomic50 FIX 1+3: regen snapshot — Tin Ceiling Tile (29 on-s 9d456da →