diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 186355f862..e765c75ba1 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "6.68.0", + "version": "6.68.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "6.68.0", + "version": "6.68.1", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@hello-pangea/dnd": "18.0.1", diff --git a/packages/components/package.json b/packages/components/package.json index 7869bedd9a..7093ac4805 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "6.68.0", + "version": "6.68.1", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ diff --git a/packages/components/releaseNotes/components.md b/packages/components/releaseNotes/components.md index 34b4cf0e96..0ece3a35b2 100644 --- a/packages/components/releaseNotes/components.md +++ b/packages/components/releaseNotes/components.md @@ -1,6 +1,11 @@ # @labkey/components Components, models, actions, and utility functions for LabKey applications and pages +### version 6.68.1 +*Released* 2 November 2025 +- Issue 52063: Domain designer to handle lookup to a query with a pipe character + - don't just split on '|', as the queryName could contain '|' characters + ### version 6.68.0 *Released* 2 November 2025 - Add auditing of what method was used for CRUD diff --git a/packages/components/src/internal/components/domainproperties/models.test.ts b/packages/components/src/internal/components/domainproperties/models.test.ts index f0edf0a680..349ccd495a 100644 --- a/packages/components/src/internal/components/domainproperties/models.test.ts +++ b/packages/components/src/internal/components/domainproperties/models.test.ts @@ -51,6 +51,7 @@ import { import { acceptablePropertyType, + decodeLookup, DEFAULT_TEXT_CHOICE_VALIDATOR, DomainDesign, DomainField, @@ -1522,3 +1523,51 @@ describe('resolveLookupQueryValue', () => { ); }); }); + +describe('decodeLookup', () => { + test('base', () => { + let result = decodeLookup('http://www.w3.org/2001/XMLSchema#string|query'); + expect(result.rangeURI).toBe('http://www.w3.org/2001/XMLSchema#string'); + expect(result.queryName).toBe('query'); + + result = decodeLookup('http://www.w3.org/2001/XMLSchema#int|anotherQuery'); + expect(result.rangeURI).toBe('http://www.w3.org/2001/XMLSchema#int'); + expect(result.queryName).toBe('anotherQuery'); + + result = decodeLookup('http://www.w3.org/2001/XMLSchema#dateTime|dateQuery'); + expect(result.rangeURI).toBe('http://www.w3.org/2001/XMLSchema#dateTime'); + expect(result.queryName).toBe('dateQuery'); + }); + + test('invalid', () => { + let result = decodeLookup(undefined); + expect(result.rangeURI).toBeUndefined(); + expect(result.queryName).toBeUndefined(); + + result = decodeLookup('invalidStringWithoutDelimiter'); + expect(result.rangeURI).toBe('invalidStringWithoutDelimiter'); + expect(result.queryName).toBeUndefined(); + + result = decodeLookup(''); + expect(result.rangeURI).toBe(''); + expect(result.queryName).toBeUndefined(); + + result = decodeLookup('onlyDelimiter|'); + expect(result.rangeURI).toBe('onlyDelimiter'); + expect(result.queryName).toBe(''); + + result = decodeLookup('|onlyQueryName'); + expect(result.rangeURI).toBe(''); + expect(result.queryName).toBe('onlyQueryName'); + }); + + test('multipl | delimiters', () => { + let result = decodeLookup('http://www.w3.org/2001/XMLSchema#string|query|extra'); + expect(result.rangeURI).toBe('http://www.w3.org/2001/XMLSchema#string'); + expect(result.queryName).toBe('query|extra'); + + result = decodeLookup('http://www.w3.org/2001/XMLSchema#int|another|query|with|pipes'); + expect(result.rangeURI).toBe('http://www.w3.org/2001/XMLSchema#int'); + expect(result.queryName).toBe('another|query|with|pipes'); + }); +}); diff --git a/packages/components/src/internal/components/domainproperties/models.tsx b/packages/components/src/internal/components/domainproperties/models.tsx index 0937d8157f..901b6b9260 100644 --- a/packages/components/src/internal/components/domainproperties/models.tsx +++ b/packages/components/src/internal/components/domainproperties/models.tsx @@ -1531,7 +1531,10 @@ export function getValidValuesDetailStr(validValues: string[]): string { } export function decodeLookup(value: string): { queryName: string; rangeURI: string } { - const [rangeURI, queryName] = value ? value.split('|') : [undefined, undefined]; + // Issue 52063: don't just split on '|', as the queryName could contain '|' characters + const separatorIndex = value?.indexOf('|') ?? -1; + const rangeURI = separatorIndex === -1 ? value : value.substring(0, separatorIndex); + const queryName = separatorIndex === -1 ? undefined : value.substring(separatorIndex + 1); return { queryName,