From b3e213c133b28100b947a6a96416c2639cae64ac Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Tue, 18 Jul 2023 12:58:53 -0300 Subject: [PATCH] fix: Added replace special caracters and espaces in instanceName --- src/whatsapp/controllers/instance.controller.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/whatsapp/controllers/instance.controller.ts b/src/whatsapp/controllers/instance.controller.ts index cf8678c1..f0adb3a3 100644 --- a/src/whatsapp/controllers/instance.controller.ts +++ b/src/whatsapp/controllers/instance.controller.ts @@ -64,7 +64,10 @@ export class InstanceController { this.repository, this.cache, ); - instance.instanceName = instanceName; + instance.instanceName = instanceName + .toLowerCase() + .replace(/[^a-z0-9]/g, '') + .replace(' ', ''); this.logger.verbose('instance: ' + instance.instanceName + ' created'); this.waMonitor.waInstances[instance.instanceName] = instance; @@ -191,7 +194,10 @@ export class InstanceController { this.repository, this.cache, ); - instance.instanceName = instanceName; + instance.instanceName = instanceName + .toLowerCase() + .replace(/[^a-z0-9]/g, '') + .replace(' ', ''); this.logger.verbose('instance: ' + instance.instanceName + ' created');