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
|
firstBlockIsIV = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const endChunk = endByte ? toSmallestChunkSize(endByte || 0)+AES_CHUNK_SIZE : undefined
|
const endChunk = endByte ? toSmallestChunkSize(endByte || 0)+AES_CHUNK_SIZE : undefined
|
||||||
let rangeHeader: string | undefined = undefined
|
|
||||||
if(startChunk || endChunk) {
|
const headers: { [_: string]: string } = {
|
||||||
rangeHeader = `bytes=${startChunk}-`
|
Origin: DEFAULT_ORIGIN,
|
||||||
if(endChunk) rangeHeader += endChunk
|
|
||||||
}
|
}
|
||||||
|
if(startChunk || endChunk) {
|
||||||
|
headers.Range = `bytes=${startChunk}-`
|
||||||
|
if(endChunk) headers.Range += endChunk
|
||||||
|
}
|
||||||
|
|
||||||
// download the message
|
// download the message
|
||||||
const fetched = await getHttpStream(downloadUrl, {
|
const fetched = await getHttpStream(downloadUrl, { headers })
|
||||||
headers: {
|
|
||||||
Origin: DEFAULT_ORIGIN,
|
|
||||||
Range: rangeHeader
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
let remainingBytes = Buffer.from([])
|
let remainingBytes = Buffer.from([])
|
||||||
const { cipherKey, iv } = getMediaKeys(mediaKey, type)
|
const { cipherKey, iv } = getMediaKeys(mediaKey, type)
|
||||||
|
|||||||
Reference in New Issue
Block a user