From 7a442e1e30d3db1c2ee1109700a4ced15f736608 Mon Sep 17 00:00:00 2001 From: Heiko Rothe Date: Sat, 13 Feb 2021 17:38:32 +0100 Subject: [PATCH] fix(bluetooth-low-energy): interpret allowlist as strings For only numeric values YAML will be interpreted as number by default. This ensures that we convert those cases to strings as well. Closes #534 --- .../bluetooth-low-energy/bluetooth-low-energy.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts b/src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts index fb3c6000..74236d34 100644 --- a/src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts +++ b/src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts @@ -270,7 +270,9 @@ export class BluetoothLowEnergyService return this.config.allowlistRegex || this.config.whitelistRegex ? allowlist.some((regex) => id.match(regex)) - : allowlist.map((x) => x.toLowerCase()).includes(id.toLowerCase()); + : allowlist + .map((x) => String(x).toLowerCase()) + .includes(id.toLowerCase()); } /** @@ -290,7 +292,7 @@ export class BluetoothLowEnergyService return this.config.denylistRegex || this.config.blacklistRegex ? denylist.some((regex) => id.match(regex)) - : denylist.map((x) => x.toLowerCase()).includes(id.toLowerCase()); + : denylist.map((x) => String(x).toLowerCase()).includes(id.toLowerCase()); } /**