Skip to content

Commit d7f264c

Browse files
committed
fix: It is now validated if the instance name contains uppercase and special characters
1 parent 897f816 commit d7f264c

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Correction in the use of the api with mongodb
77
* Adjustments to search endpoint for contacts, chats, messages and Status messages
88
* Now when deleting the instance, the data referring to it in mongodb is also deleted
9+
* It is now validated if the instance name contains uppercase and special characters
910

1011
# 1.3.1 (2023-07-20 07:48)
1112

src/whatsapp/controllers/instance.controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ export class InstanceController {
4242
}: InstanceDto) {
4343
this.logger.verbose('requested createInstance from ' + instanceName + ' instance');
4444

45+
if (instanceName !== instanceName.toLowerCase().replace(/[^a-z0-9]/g, '')) {
46+
throw new BadRequestException(
47+
'The instance name must be lowercase and without special characters',
48+
);
49+
}
50+
4551
const mode = this.configService.get<Auth>('AUTHENTICATION').INSTANCE.MODE;
4652

4753
if (mode === 'container') {

src/whatsapp/services/whatsapp.service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,8 +1412,6 @@ export class WAStartupService {
14121412
}
14131413

14141414
if (Number(countryCode) === 52 || Number(countryCode) === 54) {
1415-
console.log('numero mexicano');
1416-
14171415
const formattedMXARNumber = this.formatMXOrARNumber(number);
14181416

14191417
if (formattedMXARNumber !== number) {

0 commit comments

Comments
 (0)