commit c4b8ab272413b3200a26f504928d9b6cdaca74ca parent 9c04ec5a5478aa6cbcc3cdb3ff01990d7dae4135 Author: Sergej Orlov <wladimirych@gmail.com> Date: Sun, 20 Mar 2022 11:00:21 +0100 wikimedia photos: fix evaluation of file extension Diffstat:
M | src/lib/leaflet.control.panoramas/lib/wikimedia/index.js | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js b/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js @@ -23,7 +23,8 @@ function parseSearchResponse(resp) { // eslint-disable-line complexity if (resp && resp.query && resp.query.pages && resp.query.pages) { for (let page of Object.values(resp.query.pages)) { const coordinates = page.coordinates?.[0]; - const [baseName, extension] = (page.title ?? '').split('.', 2); + const pageTitle = page.title ?? ''; + const extension = pageTitle.split('.').pop(); if ( !coordinates || coordinates.globe !== 'earth' || @@ -31,8 +32,8 @@ function parseSearchResponse(resp) { // eslint-disable-line complexity coordinates.lat === 0 || coordinates.lon === 0 || coordinates.lat === coordinates.lon || - (baseName ?? '').includes('View of Earth') || - (extension ?? '').toLowerCase() !== 'jpg' + pageTitle.includes('View of Earth') || + extension.toLowerCase() !== 'jpg' ) { continue; }