test: decode URI component

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
This commit is contained in:
Vinayak Kulkarni 2023-01-08 20:59:43 +05:30
parent 8d3704c021
commit 33cb7e82b4
No known key found for this signature in database
GPG key ID: B8C8194CED989C08

View file

@ -150,14 +150,15 @@ const parseCoordinates = (coordinatePair, query, transformer) => {
* @param {Function} transformer Optional transform function. * @param {Function} transformer Optional transform function.
*/ */
const extractPathsFromQuery = (query, transformer) => { const extractPathsFromQuery = (query, transformer) => {
const reqPath = decodeURIComponent(query.path);
const paths = []; const paths = [];
// Return an empty list if no paths have been provided // Return an empty list if no paths have been provided
if ('path' in query && !query.path) { if ('path' in query && !query.path) {
return paths; return paths;
} }
// Parse paths provided via path query argument // Parse paths provided via path query argument
if ('path' in query && PATH_PATTERN.test(query.path)) { if ('path' in query && PATH_PATTERN.test(reqPath)) {
if (query.path.includes('enc:')) { if (reqPath.includes('enc:')) {
const splitPaths = query.path.split('|'); const splitPaths = query.path.split('|');
const line = splitPaths const line = splitPaths
.filter( .filter(