Skip to content

Commit

Permalink
Merge branch 'encode-filter' of JulianKniephoff/opencast-admin-interf…
Browse files Browse the repository at this point in the history
…ace into main

Pull request opencast#958

  URL-encode `filter` parameter for `/admin-ng`-endpoints
  • Loading branch information
gregorydlogan committed Nov 5, 2024
2 parents b25f6ae + 86322ba commit 80c2f78
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/resourceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export const getURLParams = (

// check if textFilter has value and transform for use as URL param
if (textFilter !== "") {
filters.push("textFilter:" + textFilter);
filters.push(["textFilter", textFilter]);
}
// transform filters for use as URL param
for (let key in filterMap) {
if (!!filterMap[key].value) {
filters.push(filterMap[key].name + ":" + filterMap[key].value.toString());
filters.push([filterMap[key].name, filterMap[key].value.toString()]);
}
}

Expand All @@ -63,7 +63,9 @@ export const getURLParams = (
if (filters.length) {
params = {
...params,
filter: filters.join(","),
filter: filters
.map(([key, value]) => `${key}:${encodeURIComponent(value)}`)
.join(","),
};
}

Expand Down

0 comments on commit 80c2f78

Please sign in to comment.