From 2198bb5a1981177b04dd94b2b1b6a90c5d7a5c25 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Nov 2022 14:21:40 +0100 Subject: Prevent XSS with ng-select When using ng-option See https://github.com/ng-select/ng-select/issues/1363 --- .../src/app/shared/shared-forms/select/select-channel.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/shared-forms') diff --git a/client/src/app/shared/shared-forms/select/select-channel.component.ts b/client/src/app/shared/shared-forms/select/select-channel.component.ts index 5fcae0050..26d6216ef 100644 --- a/client/src/app/shared/shared-forms/select/select-channel.component.ts +++ b/client/src/app/shared/shared-forms/select/select-channel.component.ts @@ -39,8 +39,10 @@ export class SelectChannelComponent implements ControlValueAccessor, OnChanges { propagateChange = (_: any) => { /* empty */ } - writeValue (id: number) { - this.selectedId = id + writeValue (id: number | string) { + this.selectedId = typeof id === 'string' + ? parseInt(id, 10) + : id } registerOnChange (fn: (_: any) => void) { -- cgit v1.2.3