Skip to content

Commit

Permalink
Encode Values returned from DB
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-leech committed Oct 25, 2023
1 parent 301862d commit 8f5e21f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ui/elements/dropdown.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default (params) => {
// Set btn text to reflect selection or show placeholder.
btn.querySelector('[data-id=header-span]')
.textContent = params.selectedTitles.size && Array.from(params.selectedTitles).map(v => decodeURIComponent(v)).join(', ')
.textContent = params.selectedTitles.size && Array.from(params.selectedTitles).map(v => decodeURIComponent(encodeURIComponent(v))).join(', ')
|| params.span || params.placeholder
// Execute callback method and pass array of current selection.
Expand Down
5 changes: 4 additions & 1 deletion lib/ui/layers/filters.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ async function filter_in(layer, filter) {

if (filter.dropdown) {

// Encode values for dropdown.
const encoded = filter[filter.type].map(val => encodeURIComponent(val));

return mapp.ui.elements.dropdown({
multi: true,
placeholder: 'Select Multiple',
entries: filter[filter.type].map(val => ({
entries: encoded.map(val => ({
title: decodeURIComponent(val),
option: encodeURIComponent(val),
selected: chkSet.has(val)
Expand Down

0 comments on commit 8f5e21f

Please sign in to comment.