From 494b2a114c55c15de6628261333cc0c39f061a56 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Tue, 3 Feb 2026 09:54:41 +0100 Subject: [PATCH] fix: strip hash prefix from marker colors in URL construction The old extension (OcapReplaySaver2) sends marker colors with a # prefix (e.g., #E60000), but the URL construction expected colors without it. The # character in URLs is interpreted as a fragment identifier by the browser, causing everything after it to be dropped and resulting in 404 errors for marker images. This strips the # prefix if present while maintaining backward compatibility with data that doesn't include the prefix. --- static/scripts/ocap.marker.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/static/scripts/ocap.marker.js b/static/scripts/ocap.marker.js index f9aec03df..c7d5f4b37 100644 --- a/static/scripts/ocap.marker.js +++ b/static/scripts/ocap.marker.js @@ -4,7 +4,9 @@ class Marker { this._typeLower = type.toLowerCase(); this._text = text; this._player = player; // Entity obj - this._color = `#${color}`; // 00FF00 (hex color) + // Strip # prefix if present (old extension sends colors with #, new without) + const colorHex = color.replace(/^#/, ''); + this._color = `#${colorHex}`; // hex color for CSS this._startFrame = startFrame; // 22 this._endFrame = endFrame; // 35 this._side = side; // -1,0,1,2 (int, pairs to global array) @@ -41,12 +43,12 @@ class Marker { if (this._type.search("magIcons") > -1) { this._icon = L.icon({ iconSize: [35, 35], iconUrl: `images/markers/${this._typeLower}.png` }); } else if (!this._shape || !this._size) { - this._icon = L.icon({ iconSize: [35, 35], iconUrl: `images/markers/${type}/${color}.png` }); + this._icon = L.icon({ iconSize: [35, 35], iconUrl: `images/markers/${type}/${colorHex}.png` }); } else if (this._shape == "ICON") { this._size = this._size.map(value => { return (value * 35); }); - this._icon = L.icon({ iconSize: this._size, iconUrl: `images/markers/${type}/${color}.png` }); + this._icon = L.icon({ iconSize: this._size, iconUrl: `images/markers/${type}/${colorHex}.png` }); } else { this._icon = null; }