diff --git a/apps/server/src/api-integration/integration.controller.ts b/apps/server/src/api-integration/integration.controller.ts index 57a8dc7f7..662f1c35d 100644 --- a/apps/server/src/api-integration/integration.controller.ts +++ b/apps/server/src/api-integration/integration.controller.ts @@ -47,8 +47,8 @@ const actionHandlers: Record = { if (typeof property !== 'string' || value === undefined) { throw new Error('Invalid property or value'); } - // all custom fields keys are lowercase - const newObjectProperty = parseProperty(property.toLowerCase(), value); + + const newObjectProperty = parseProperty(property, value); if (patchEvent.custom && newObjectProperty.custom) { Object.assign(patchEvent.custom, newObjectProperty.custom); diff --git a/apps/server/src/api-integration/integration.utils.ts b/apps/server/src/api-integration/integration.utils.ts index 3134c20fc..8e0ae55fc 100644 --- a/apps/server/src/api-integration/integration.utils.ts +++ b/apps/server/src/api-integration/integration.utils.ts @@ -23,14 +23,13 @@ const whitelistedPayload = { export function parseProperty(property: string, value: unknown) { if (property.startsWith('custom:')) { - const customKey = property.split(':')[1]; + const customKey = property.split(':')[1].toLocaleLowerCase(); // all custom fields keys are lowercase if (!(customKey in DataProvider.getCustomFields())) { throw new Error(`Custom field ${customKey} not found`); } const parserFn = whitelistedPayload.custom; return { custom: { [customKey]: parserFn(value) } }; } - if (!isKeyOfType(property, whitelistedPayload)) { throw new Error(`Property ${property} not permitted`); }