Merge pull request #1748 from coreh/fix-url-corruption-querystring
Some checks failed
Build Docker image / Build and Deploy (push) Has been cancelled

Avoid corrupting media URLs with query strings
This commit is contained in:
Davidson Gomes 2025-07-25 16:56:06 -03:00 committed by GitHub
commit c66485ef98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2558,7 +2558,9 @@ export class BaileysStartupService extends ChannelStartupService {
imageBuffer = Buffer.from(base64Data, 'base64');
} else {
const timestamp = new Date().getTime();
const url = `${image}?timestamp=${timestamp}`;
const parsedURL = new URL(image);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
let config: any = { responseType: 'arraybuffer' };
@ -2779,7 +2781,9 @@ export class BaileysStartupService extends ChannelStartupService {
if (isURL(audio)) {
const timestamp = new Date().getTime();
const url = `${audio}?timestamp=${timestamp}`;
const parsedURL = new URL(audio);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
const config: any = { responseType: 'stream' };
@ -3705,7 +3709,9 @@ export class BaileysStartupService extends ChannelStartupService {
let pic: WAMediaUpload;
if (isURL(picture)) {
const timestamp = new Date().getTime();
const url = `${picture}?timestamp=${timestamp}`;
const parsedURL = new URL(picture);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
let config: any = { responseType: 'arraybuffer' };
@ -3987,7 +3993,9 @@ export class BaileysStartupService extends ChannelStartupService {
let pic: WAMediaUpload;
if (isURL(picture.image)) {
const timestamp = new Date().getTime();
const url = `${picture.image}?timestamp=${timestamp}`;
const parsedURL = new URL(picture.image);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
let config: any = { responseType: 'arraybuffer' };