diff --git a/src/Utils/messages-media.ts b/src/Utils/messages-media.ts index 4f61a78..b15ee9d 100644 --- a/src/Utils/messages-media.ts +++ b/src/Utils/messages-media.ts @@ -607,28 +607,19 @@ export const getWAUploadToServer = ( let urls: { mediaUrl: string, directPath: string } | undefined const hosts = [ ...customUploadHosts, ...uploadInfo.hosts ] - const chunks: Buffer[] = [] - for await (const chunk of stream) { - chunks.push(chunk) - } - - const reqBody = Buffer.concat(chunks) fileEncSha256B64 = encodeBase64EncodedStringForUpload(fileEncSha256B64) - for(const { hostname, maxContentLengthBytes } of hosts) { + for(const { hostname } of hosts) { logger.debug(`uploading to "${hostname}"`) const auth = encodeURIComponent(uploadInfo.auth) // the auth token const url = `https://${hostname}${MEDIA_PATH_MAP[mediaType]}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}` let result: any try { - if(maxContentLengthBytes && reqBody.length > maxContentLengthBytes) { - throw new Boom(`Body too large for "${hostname}"`, { statusCode: 413 }) - } const body = await axios.post( url, - reqBody, + stream, { ...options, headers: {