This commit is contained in:
Martin d'Allens 2023-10-11 14:38:52 +00:00 committed by GitHub
commit 600307f240
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View file

@ -158,10 +158,7 @@ const extractPathsFromQuery = (query, transformer) => {
// Iterate through paths, parse and validate them
for (const providedPath of providedPaths) {
// Logic for pushing coords to path when path includes google polyline
if (
providedPath.includes('enc:') &&
PATH_PATTERN.test(decodeURIComponent(providedPath))
) {
if (providedPath.includes('enc:') && PATH_PATTERN.test(providedPath)) {
// +4 because 'enc:' is 4 characters, everything after 'enc:' is considered to be part of the polyline
const encIndex = providedPath.indexOf('enc:') + 4;
const coords = polyline
@ -427,7 +424,7 @@ const drawMarkers = async (ctx, markers, z) => {
* @param {number} z Map zoom level.
*/
const drawPath = (ctx, path, query, pathQuery, z) => {
const splitPaths = decodeURIComponent(pathQuery).split('|');
const splitPaths = pathQuery.split('|');
if (!path || path.length < 2) {
return null;

View file

@ -180,7 +180,7 @@ describe('Static endpoints', function () {
200,
2,
/image\/png/,
'?path=' + decodeURIComponent('enc:{{biGwvyGoUi@s_A|{@'),
'?path=' + encodeURIComponent('enc:{{biGwvyGoUi@s_A|{@'),
);
});
});