mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 19:49:16 +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 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 decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
|
||||
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
|
||||
|
||||
Reference in New Issue
Block a user