Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 1.X - 2026-X
- GitHub Issue 966: Grid filter UI parses URL parameter incorrectly for array data

### 1.51.0 - 2026-03-31
- Package updates

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labkey/api",
"version": "1.51.0",
"version": "1.51.1-mvtcBatch3.1",
"description": "JavaScript client API for LabKey Server",
"scripts": {
"build": "npm run build:dist && npm run build:docs",
Expand Down
14 changes: 14 additions & 0 deletions src/labkey/filter/Types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ describe('parseValue', () => {
expect(type.parseValue(value)).toEqual(['value1', 'value2', 'value3']);
});

it('should parse JSON formatted values containing closing brace in value', () => {
const type = Types.IN;
const value = '{json:["a}b;c"]}';
expect(type.parseValue(value)).toEqual(['a}b;c']);
});

it('should round-trip values containing both separator and closing brace', () => {
const type = Types.IN;
const original = ['a}b;c', 'x;y}z'];
const encoded = type.getURLParameterValue(original);
expect(encoded).toBe('{json:["a}b;c","x;y}z"]}');
expect(type.parseValue(encoded)).toEqual(original);
});

it('should fall back to regex parsing if JSON is invalid', () => {
const type = Types.IN;
// Invalid JSON: missing closing quote for value2
Expand Down
3 changes: 2 additions & 1 deletion src/labkey/filter/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ export function getFilterTypesForType(jsonType: JsonType, mvEnabled?: boolean):
const NEW_LINE_SEP = '\n';

export function parseMultiValueFilterString(type: IFilterType, value: string) {
if (value.indexOf('{json:') === 0 && value.indexOf('}') === value.length - 1) {
// GH Issue 966: Grid filter UI parses URL parameter incorrectly for value a}b;c
if (value.startsWith('{json:') && value.endsWith('}')) {
try {
return JSON.parse(value.substring('{json:'.length, value.length - 1));
} catch {
Expand Down
Loading