mod-baileys 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Utils/messages-media.js +12 -11
- package/package.json +1 -1
|
@@ -654,7 +654,14 @@ function extensionForMediaMessage(message) {
|
|
|
654
654
|
return extension;
|
|
655
655
|
}
|
|
656
656
|
exports.extensionForMediaMessage = extensionForMediaMessage;
|
|
657
|
-
|
|
657
|
+
|
|
658
|
+
const getWAUploadToServer = ({
|
|
659
|
+
customUploadHosts,
|
|
660
|
+
fetchAgent,
|
|
661
|
+
logger, options
|
|
662
|
+
},
|
|
663
|
+
refreshMediaConn
|
|
664
|
+
) => {
|
|
658
665
|
return async (stream, { mediaType, fileEncSha256B64, newsletter, timeoutMs }) => {
|
|
659
666
|
var _a, _b;
|
|
660
667
|
const { default: axios } = await import('axios');
|
|
@@ -662,13 +669,7 @@ const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, options },
|
|
|
662
669
|
let uploadInfo = await refreshMediaConn(false);
|
|
663
670
|
let urls;
|
|
664
671
|
const hosts = [...customUploadHosts, ...uploadInfo.hosts];
|
|
665
|
-
const
|
|
666
|
-
if (!Buffer.isBuffer(stream)) {
|
|
667
|
-
for await (const chunk of stream) {
|
|
668
|
-
chunks.push(chunk);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
const reqBody = Buffer.isBuffer(stream) ? stream : Buffer.concat(chunks);
|
|
672
|
+
const reqBody = stream;
|
|
672
673
|
fileEncSha256B64 = (0, exports.encodeBase64EncodedStringForUpload)(fileEncSha256B64);
|
|
673
674
|
let media = Defaults_1.MEDIA_PATH_MAP[mediaType];
|
|
674
675
|
if (newsletter) {
|
|
@@ -680,9 +681,9 @@ const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, options },
|
|
|
680
681
|
const url = `https://${hostname}${media}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}`;
|
|
681
682
|
let result;
|
|
682
683
|
try {
|
|
683
|
-
if (maxContentLengthBytes && reqBody.length > maxContentLengthBytes) {
|
|
684
|
-
|
|
685
|
-
}
|
|
684
|
+
// if (maxContentLengthBytes && reqBody.length > maxContentLengthBytes) {
|
|
685
|
+
// throw new boom_1.Boom(`Body too large for "${hostname}"`, { statusCode: 413 });
|
|
686
|
+
// }
|
|
686
687
|
const body = await axios.post(url, reqBody, {
|
|
687
688
|
...options,
|
|
688
689
|
headers: {
|