mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 19:49:16 +00:00
Fix: Cannot read properties of undefined (reading 'getProfilePicFull') (#1362)
* Fix for issue#1356 - Cannot read properties of undefined reading getProfilePicFull * use cross-compatible profilePicFind function Co-authored-by: Joaquin Touris <joaquin@192.168.1.6> Co-authored-by: Pedro Lopez <pedroslopez@me.com>
This commit is contained in:
@@ -877,19 +877,15 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
async getProfilePicUrl(contactId) {
|
||||
const profilePic = await this.pupPage.evaluate(async contactId => {
|
||||
let asyncPic;
|
||||
if (window.Store.Features.features.MD_BACKEND) {
|
||||
try {
|
||||
const chatWid = window.Store.WidFactory.createWid(contactId);
|
||||
asyncPic = await window.Store.getProfilePicFull(chatWid).catch(() => {
|
||||
return undefined;
|
||||
});
|
||||
} else {
|
||||
asyncPic = await window.Store.Wap.profilePicFind(contactId).catch(() => {
|
||||
return undefined;
|
||||
});
|
||||
return await window.Store.ProfilePic.profilePicFind(chatWid);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return undefined;
|
||||
throw err;
|
||||
}
|
||||
return asyncPic;
|
||||
}, contactId);
|
||||
|
||||
return profilePic ? profilePic.eurl : undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user