From b0a5223ce750a1e925025f6ac30cc53071f8dd9e Mon Sep 17 00:00:00 2001 From: Brett Hoerner Date: Fri, 20 Oct 2023 07:17:43 -0600 Subject: [PATCH] fix(plugin-server): filter NaN out of buildIntegerMatcher (#18106) --- plugin-server/src/config/config.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugin-server/src/config/config.ts b/plugin-server/src/config/config.ts index bbce44eeeeff28..4979769543163f 100644 --- a/plugin-server/src/config/config.ts +++ b/plugin-server/src/config/config.ts @@ -227,14 +227,19 @@ export function overrideWithEnv( } export function buildIntegerMatcher(config: string | undefined, allowStar: boolean): ValueMatcher { - // Builds a ValueMatcher on a coma-separated list of values. + // Builds a ValueMatcher on a comma-separated list of values. // Optionally, supports a '*' value to match everything - if (!config) { + if (!config || config.trim().length == 0) { return () => false } else if (allowStar && config === '*') { return () => true } else { - const values = new Set(config.split(',').map((n) => parseInt(n))) + const values = new Set( + config + .split(',') + .map((n) => parseInt(n)) + .filter((num) => !isNaN(num)) + ) return (v: number) => { return values.has(v) }