mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-21 13:09:15 +00:00
fix: properly download media if it has not been loaded
This issue occurred when attempting to download media from old messages.
This commit is contained in:
@@ -188,6 +188,11 @@ class Message extends Base {
|
|||||||
|
|
||||||
const {data, mimetype, filename} = await this.client.pupPage.evaluate(async (msgId) => {
|
const {data, mimetype, filename} = await this.client.pupPage.evaluate(async (msgId) => {
|
||||||
const msg = window.Store.Msg.get(msgId);
|
const msg = window.Store.Msg.get(msgId);
|
||||||
|
|
||||||
|
if(msg.mediaData.mediaStage != 'RESOLVED') {
|
||||||
|
await msg.downloadMedia(true, 1);
|
||||||
|
}
|
||||||
|
|
||||||
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
|
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
|
||||||
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
|
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
|
||||||
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
|
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
|
||||||
|
|||||||
Reference in New Issue
Block a user