mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: download on axios
This commit is contained in:
@@ -324,19 +324,18 @@ export const downloadContentFromMessage = async(
|
||||
firstBlockIsIV = true
|
||||
}
|
||||
}
|
||||
const endChunk = endByte ? toSmallestChunkSize(endByte || 0)+AES_CHUNK_SIZE : undefined
|
||||
let rangeHeader: string | undefined = undefined
|
||||
if(startChunk || endChunk) {
|
||||
rangeHeader = `bytes=${startChunk}-`
|
||||
if(endChunk) rangeHeader += endChunk
|
||||
const endChunk = endByte ? toSmallestChunkSize(endByte || 0)+AES_CHUNK_SIZE : undefined
|
||||
|
||||
const headers: { [_: string]: string } = {
|
||||
Origin: DEFAULT_ORIGIN,
|
||||
}
|
||||
if(startChunk || endChunk) {
|
||||
headers.Range = `bytes=${startChunk}-`
|
||||
if(endChunk) headers.Range += endChunk
|
||||
}
|
||||
|
||||
// download the message
|
||||
const fetched = await getHttpStream(downloadUrl, {
|
||||
headers: {
|
||||
Origin: DEFAULT_ORIGIN,
|
||||
Range: rangeHeader
|
||||
}
|
||||
})
|
||||
const fetched = await getHttpStream(downloadUrl, { headers })
|
||||
|
||||
let remainingBytes = Buffer.from([])
|
||||
const { cipherKey, iv } = getMediaKeys(mediaKey, type)
|
||||
|
||||
Reference in New Issue
Block a user