From d6478da03f27bed6203b6322ea61ccf88212b01b Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Sun, 1 Feb 2026 09:10:45 -0800 Subject: [PATCH] Fix brand color display and header upload collision - Brand color: add # prefix when loading from DB (stored without #, CSS needs it for backgroundColor) - Header upload: delete destination file before rename to prevent collision when re-uploading same extension - Header preview: prepend BASE_PATH to image URL for local dev Co-Authored-By: Claude Opus 4.5 --- api/menu/uploadHeader.cfm | 11 ++++++++++- portal/portal.js | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/api/menu/uploadHeader.cfm b/api/menu/uploadHeader.cfm index 24331a0..de9d96d 100644 --- a/api/menu/uploadHeader.cfm +++ b/api/menu/uploadHeader.cfm @@ -64,8 +64,17 @@ if (bizId LTE 0) { + + + + + + + + + - + diff --git a/portal/portal.js b/portal/portal.js index fb24814..665a09e 100644 --- a/portal/portal.js +++ b/portal/portal.js @@ -758,12 +758,12 @@ const Portal = { document.getElementById('settingState').value = biz.ADDRESSSTATE || ''; document.getElementById('settingZip').value = biz.ADDRESSZIP || ''; - // Load brand color if set + // Load brand color if set (DB stores without #, CSS needs it) const brandColor = biz.BRANDCOLOR || ''; if (brandColor) { - this.brandColor = brandColor; + this.brandColor = brandColor.charAt(0) === '#' ? brandColor : '#' + brandColor; const swatch = document.getElementById('brandColorSwatch'); - if (swatch) swatch.style.backgroundColor = brandColor; + if (swatch) swatch.style.backgroundColor = this.brandColor; } // Load header preview @@ -774,7 +774,7 @@ const Portal = { headerPreview.onload = function() { if (headerWrapper) headerWrapper.style.display = 'block'; }; - headerPreview.src = `${headerUrl}?t=${Date.now()}`; + headerPreview.src = `${BASE_PATH}${headerUrl}?t=${Date.now()}`; } // Render hours editor