From b191e1b23a9a66d65c872f4f3c991aeb65ddfbfe Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Fri, 31 Dec 2021 15:14:55 +0530 Subject: [PATCH] fix: remove limits on max body and content length --- src/Utils/messages-media.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Utils/messages-media.ts b/src/Utils/messages-media.ts index eed51584..291e4c72 100644 --- a/src/Utils/messages-media.ts +++ b/src/Utils/messages-media.ts @@ -335,7 +335,14 @@ export const downloadContentFromMessage = async( } // download the message - const fetched = await getHttpStream(downloadUrl, { headers }) + const fetched = await getHttpStream( + downloadUrl, + { + headers, + maxBodyLength: Infinity, + maxContentLength: Infinity, + } + ) let remainingBytes = Buffer.from([]) const { cipherKey, iv } = getMediaKeys(mediaKey, type) @@ -476,7 +483,9 @@ export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger }: C }, httpsAgent: fetchAgent, timeout: timeoutMs, - responseType: 'json' + responseType: 'json', + maxBodyLength: Infinity, + maxContentLength: Infinity, } ) @@ -492,7 +501,7 @@ export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger }: C } } catch (error) { const isLast = hostname === hosts[uploadInfo.hosts.length-1] - logger.debug(`Error in uploading to ${hostname} (${error}) ${isLast ? '' : ', retrying...'}`) + logger.debug({ trace: error.stack }, `Error in uploading to ${hostname} ${isLast ? '' : ', retrying...'}`) } } if (!urls) {