← back to Selfadhesivewallpaper
fix: safeImg allow same-origin /img/ proxy urls (vendor-neutral image proxy 2026-06-03) — product cards were falling back to hero-bg (images all wrong)
d2ea5acac1d6be10c9f6f58ec8cace904015062f · 2026-06-18 09:04:29 -0700 · Steve Abrams
Files touched
Diff
commit d2ea5acac1d6be10c9f6f58ec8cace904015062f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Jun 18 09:04:29 2026 -0700
fix: safeImg allow same-origin /img/ proxy urls (vendor-neutral image proxy 2026-06-03) — product cards were falling back to hero-bg (images all wrong)
---
public/index.html | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/public/index.html b/public/index.html
index f3ca42f..31b894c 100644
--- a/public/index.html
+++ b/public/index.html
@@ -585,8 +585,10 @@ const HOSTKEY = location.hostname.replace(/\./g, '_');
const LABELS = {"self-adhesive":"Self adhesive"};
function escAttr(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&':'&','<':'<','>':'>','"':'"',"'":''' }[c])); }
-// Image-URL allowlist: only DW Shopify CDN + designerwallcoverings.com (defends against XSS via crafted products.json)
-function safeImg(u) { return /^https:\/\/(?:cdn\.shopify\.com|designerwallcoverings\.com)\//.test(u || '') ? u : '/hero-bg.jpg'; }
+// Image-URL allowlist: same-origin proxied /img/ (vendor-neutral image proxy, 2026-06-03) +
+// DW Shopify CDN + designerwallcoverings.com (defends against XSS via crafted products.json).
+// /img/ is server-controlled same-origin (not protocol-relative, not a javascript: URI) so it's safe.
+function safeImg(u) { u = u || ''; return (/^\/img\//.test(u) || /^https:\/\/(?:cdn\.shopify\.com|designerwallcoverings\.com)\//.test(u)) ? u : '/hero-bg.jpg'; }
function cardHTML(p) {
const eager = state.page === 1;
return '<img loading="' + (eager ? 'eager' : 'lazy') + '"' + (eager ? ' fetchpriority="high"' : '') + ' src="' + escAttr(safeImg(p.image_url)) + '" alt="' + escAttr(p.title) + '">'
← b84bd82 step2 vendor-leak fix: dual-key /sample resolver + handle_di
·
back to Selfadhesivewallpaper
·
Mount new-arrivals promo strip (Tier B): require ../_shared/ 14fcc84 →