Skip to content

Commit 2cadafd

Browse files
committed
Merge branch 'release/1.4.6'
2 parents 1bf2278 + bb27dca commit 2cadafd

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/whatsapp/abstract/abstract.router.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,24 @@ export abstract class RouterBroker {
104104
const instance = request.params as unknown as InstanceDto;
105105
const body = request.body;
106106

107-
if (!body?.groupJid) {
108-
if (request.query.groupJid) {
109-
Object.assign(body, {
110-
groupJid: request.query.groupJid,
111-
});
107+
let groupJid = body?.groupJid;
108+
109+
if (!groupJid) {
110+
if (request.query?.groupJid) {
111+
groupJid = request.query.groupJid;
112112
} else {
113113
throw new BadRequestException('The group id needs to be informed in the query', 'ex: "[email protected]"');
114114
}
115115
}
116-
116+
117+
if (!groupJid.endsWith('@g.us')) {
118+
groupJid = groupJid + '@g.us';
119+
}
120+
121+
Object.assign(body, {
122+
groupJid: groupJid
123+
});
124+
117125
const ref = new ClassRef();
118126

119127
Object.assign(ref, body);

src/whatsapp/controllers/instance.controller.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,12 @@ export class InstanceController {
5555
try {
5656
this.logger.verbose('requested createInstance from ' + instanceName + ' instance');
5757

58-
if (instanceName !== instanceName.toLowerCase().replace(/[^a-z0-9]/g, '')) {
59-
throw new BadRequestException('The instance name must be lowercase and without special characters');
60-
}
61-
6258
this.logger.verbose('checking duplicate token');
6359
await this.authService.checkDuplicateToken(token);
6460

6561
this.logger.verbose('creating instance');
6662
const instance = new WAStartupService(this.configService, this.eventEmitter, this.repository, this.cache);
67-
instance.instanceName = instanceName
68-
.toLowerCase()
69-
.replace(/[^a-z0-9]/g, '')
70-
.replace(' ', '');
63+
instance.instanceName = instanceName;
7164

7265
this.logger.verbose('instance: ' + instance.instanceName + ' created');
7366

0 commit comments

Comments
 (0)