From 4568027046bfc4ca3ab67f3e61e176e260b30306 Mon Sep 17 00:00:00 2001 From: Alek Kowalczyk Date: Fri, 20 Oct 2023 20:02:45 +0200 Subject: [PATCH] Fixed Issue #1025 - URL-based glyphs and fonts break displaying of vector tiles (#1026) Root cause: modified regex in #1002 caused URLs to be broken. Fixed by reverting previous regexes. Tests: * Confirmed by building and running locally with formerly breaking config.json and style json. * Run tests via Dockerfile_test --- src/serve_rendered.js | 2 +- src/serve_style.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/serve_rendered.js b/src/serve_rendered.js index 6968b4389..da92fd654 100644 --- a/src/serve_rendered.js +++ b/src/serve_rendered.js @@ -33,7 +33,7 @@ import { const FLOAT_PATTERN = '[+-]?(?:\\d+|\\d+.?\\d+)'; const PATH_PATTERN = /^((fill|stroke|width)\:[^\|]+\|)*(enc:.+|-?\d+(\.\d*)?,-?\d+(\.\d*)?(\|-?\d+(\.\d*)?,-?\d+(\.\d*)?)+)/; -const httpTester = /^\/\//; +const httpTester = /^(http(s)?:)?\/\//; const mercator = new SphericalMercator(); const getScale = (scale) => (scale || '@1x').slice(1, 2) | 0; diff --git a/src/serve_style.js b/src/serve_style.js index 5f4e5ee13..de981c786 100644 --- a/src/serve_style.js +++ b/src/serve_style.js @@ -9,7 +9,7 @@ import { validate } from '@maplibre/maplibre-gl-style-spec'; import { getPublicUrl } from './utils.js'; -const httpTester = /^\/\//; +const httpTester = /^(http(s)?:)?\/\//; const fixUrl = (req, url, publicUrl, opt_nokey) => { if (!url || typeof url !== 'string' || url.indexOf('local://') !== 0) {