Skip to content

Commit b3e213c

Browse files
committed
fix: Added replace special caracters and espaces in instanceName
1 parent a9fafec commit b3e213c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/whatsapp/controllers/instance.controller.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ export class InstanceController {
6464
this.repository,
6565
this.cache,
6666
);
67-
instance.instanceName = instanceName;
67+
instance.instanceName = instanceName
68+
.toLowerCase()
69+
.replace(/[^a-z0-9]/g, '')
70+
.replace(' ', '');
6871
this.logger.verbose('instance: ' + instance.instanceName + ' created');
6972

7073
this.waMonitor.waInstances[instance.instanceName] = instance;
@@ -191,7 +194,10 @@ export class InstanceController {
191194
this.repository,
192195
this.cache,
193196
);
194-
instance.instanceName = instanceName;
197+
instance.instanceName = instanceName
198+
.toLowerCase()
199+
.replace(/[^a-z0-9]/g, '')
200+
.replace(' ', '');
195201

196202
this.logger.verbose('instance: ' + instance.instanceName + ' created');
197203

0 commit comments

Comments
 (0)