From 9a4ef3dedf680f9336fc3c65b4b97556fd4af25e Mon Sep 17 00:00:00 2001 From: Martin d'Allens Date: Tue, 21 Nov 2023 15:06:11 +0100 Subject: [PATCH] chore: remove unused opt_nokey arg Signed-off-by: Martin d'Allens --- src/serve_style.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/serve_style.js b/src/serve_style.js index de4ccdb..d497e54 100644 --- a/src/serve_style.js +++ b/src/serve_style.js @@ -11,12 +11,12 @@ import { getPublicUrl } from './utils.js'; const httpTester = /^(http(s)?:)?\/\//; -const fixUrl = (req, url, publicUrl, opt_nokey) => { +const fixUrl = (req, url, publicUrl) => { if (!url || typeof url !== 'string' || url.indexOf('local://') !== 0) { return url; } const queryParams = []; - if (!opt_nokey && req.query.key) { + if (req.query.key) { queryParams.unshift(`key=${encodeURIComponent(req.query.key)}`); } let query = ''; @@ -42,20 +42,10 @@ export const serve_style = { } // mapbox-gl-js viewer cannot handle sprite urls with query if (styleJSON_.sprite) { - styleJSON_.sprite = fixUrl( - req, - styleJSON_.sprite, - item.publicUrl, - false, - ); + styleJSON_.sprite = fixUrl(req, styleJSON_.sprite, item.publicUrl); } if (styleJSON_.glyphs) { - styleJSON_.glyphs = fixUrl( - req, - styleJSON_.glyphs, - item.publicUrl, - false, - ); + styleJSON_.glyphs = fixUrl(req, styleJSON_.glyphs, item.publicUrl); } return res.send(styleJSON_); });