Skip to content

Commit 82ea7bd

Browse files
matheusmartinsInspermatheusmartinsInsper
authored andcommitted
fix: normalize file extension checks for case insensitivity in sticker conversion
1 parent 624a7d2 commit 82ea7bd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,7 @@ export class BaileysStartupService extends ChannelStartupService {
23512351
const isAnimated = this.isAnimated(image, imageBuffer);
23522352

23532353
if (isAnimated) {
2354-
return await sharp(imageBuffer, { animated: true }).webp({ quality: 80, animated: true }).toBuffer();
2354+
return await sharp(imageBuffer, { animated: true }).webp({ quality: 80 }).toBuffer();
23552355
} else {
23562356
return await sharp(imageBuffer).webp().toBuffer();
23572357
}
@@ -2368,9 +2368,11 @@ export class BaileysStartupService extends ChannelStartupService {
23682368
}
23692369

23702370
private isAnimated(image: string, buffer: Buffer): boolean {
2371-
if (image.includes('.gif')) return true;
2371+
const lowerCaseImage = image.toLowerCase();
23722372

2373-
if (image.includes('.webp')) return this.isAnimatedWebp(buffer);
2373+
if (lowerCaseImage.includes('.gif')) return true;
2374+
2375+
if (lowerCaseImage.includes('.webp')) return this.isAnimatedWebp(buffer);
23742376
return false;
23752377
}
23762378

0 commit comments

Comments
 (0)