diff --git a/src/Client.js b/src/Client.js index 30d9ea3..30b0b0a 100644 --- a/src/Client.js +++ b/src/Client.js @@ -876,11 +876,20 @@ class Client extends EventEmitter { * @returns {Promise} */ async getProfilePicUrl(contactId) { - const profilePic = await this.pupPage.evaluate((contactId) => { - const chatWid = window.Store.WidFactory.createWid(contactId); - return window.Store.getProfilePicFull(chatWid); + const profilePic = await this.pupPage.evaluate(async contactId => { + let asyncPic; + if (window.Store.Features.features.MD_BACKEND) { + 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 asyncPic; }, contactId); - return profilePic ? profilePic.eurl : undefined; }