From e054fc95920724d5ab36f39aa825bb878e48fe90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Thu, 8 Feb 2024 14:55:07 -0500 Subject: [PATCH] misc: fix missing account avatar Change-Id: I69acb78e60e04f74382561e130185a1aca8064d6 --- src/libclient/authority/storagehelper.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libclient/authority/storagehelper.cpp b/src/libclient/authority/storagehelper.cpp index fb5e19b0..68cfd52c 100644 --- a/src/libclient/authority/storagehelper.cpp +++ b/src/libclient/authority/storagehelper.cpp @@ -309,13 +309,15 @@ getAccountAvatar(const QString& accountId) QString filePath; filePath = accountLocalPath + "profile.vcf"; QFile file(filePath); - if (!file.open(QIODevice::ReadOnly)) + if (!file.open(QIODevice::ReadOnly)) { return {}; + } const auto vCard = lrc::vCard::utils::toHashMap(file.readAll()); - const auto photo = (vCard.find(vCard::Property::PHOTO_PNG) == vCard.end()) - ? vCard[vCard::Property::PHOTO_JPEG] - : vCard[vCard::Property::PHOTO_PNG]; - return photo; + for (const auto& key : vCard.keys()) { + if (key.contains("PHOTO")) + return vCard[key]; + } + return {}; } static QPair