Skip to content
Merged
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
8 changes: 6 additions & 2 deletions apps/meteor/app/settings/server/functions/validateSetting.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ISetting } from '@rocket.chat/core-typings';
import { isActionSettingWithEndpoint, type ISetting } from '@rocket.chat/core-typings';

export const validateSetting = <T extends ISetting>(_id: T['_id'], type: T['type'], value: T['value'] | unknown): boolean => {
switch (type) {
Expand All @@ -7,14 +7,18 @@ export const validateSetting = <T extends ISetting>(_id: T['_id'], type: T['type
throw new Error(`Setting ${_id} is of type ${type} but got ${typeof value}`);
}
break;
case 'action':
if (typeof value !== 'string' && !isActionSettingWithEndpoint(value as never)) {
throw new Error(`Setting ${_id} is of type ${type} but got ${typeof value}`);
}
break;
case 'string':
case 'relativeUrl':
case 'password':
case 'language':
case 'color':
case 'font':
case 'code':
case 'action':
case 'roomPick':
case 'group':
if (typeof value !== 'string') {
Expand Down
Loading