Skip to content

Commit 5e8dd90

Browse files
committed
Use QueryKey.decodePart
1 parent 34a9e4a commit 5e8dd90

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

  • packages/components/src/internal/query

packages/components/src/internal/query/filter.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
import { List } from 'immutable';
17-
import { Filter } from '@labkey/api';
17+
import { Filter, QueryKey } from '@labkey/api';
1818

1919
import { JsonType } from '../components/domainproperties/PropDescType';
2020
import {
@@ -24,10 +24,6 @@ import {
2424
isRelativeDateFilterValue,
2525
} from '../util/Date';
2626

27-
// N.B. the dollar sign should always be last here to avoid double-decoding (see getLegalIdentifier)
28-
const QUERY_KEY_CHAR_DECODED = ['/', '&', '}', '~', ',', '.', '$'];
29-
const QUERY_KEY_CHAR_ENCODED = ['$S', '$A', '$B', '$T', '$C', '$P', '$D'];
30-
3127
export const CONCEPT_COLUMN_FILTER_TYPES = [
3228
Filter.Types.HAS_ANY_VALUE,
3329
Filter.Types.EQUAL,
@@ -78,10 +74,7 @@ export function getLegalIdentifier(columnName: string, tableAlias?: string): str
7874
columnNameParts.forEach(part => {
7975
if (part) {
8076
let decodedPart = part.replace(/"/g, '""');
81-
QUERY_KEY_CHAR_ENCODED.forEach((encoded, ind) => {
82-
const reg = new RegExp('\\' + encoded, 'g');
83-
decodedPart = decodedPart.replace(reg, QUERY_KEY_CHAR_DECODED[ind]);
84-
});
77+
decodedPart = QueryKey.decodePart(decodedPart);
8578
formattedParts.push('"' + decodedPart + '"');
8679
}
8780
});

0 commit comments

Comments
 (0)