From 243d95701e27bda19a854eb09a6290d2eb639073 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Fri, 13 Dec 2024 11:32:00 -0500 Subject: [PATCH] fix: check if photo property is set before downloading Signed-off-by: SebastianKrupinski --- src/components/ContactsList/ContactsListItem.vue | 2 +- src/models/contact.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/ContactsList/ContactsListItem.vue b/src/components/ContactsList/ContactsListItem.vue index 4449d9051..9108bf12a 100644 --- a/src/components/ContactsList/ContactsListItem.vue +++ b/src/components/ContactsList/ContactsListItem.vue @@ -141,7 +141,7 @@ export default { return } this.avatarUrl = photoUrl - } else if (this.source.url) { + } else if (this.source.hasPhoto && this.source.url) { this.avatarUrl = `${this.source.url}?photo` } }, diff --git a/src/models/contact.js b/src/models/contact.js index a4c2734ff..0a84440f5 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -209,6 +209,16 @@ export default class Contact { this.vCard.updatePropertyWithValue('photo', photo) } + /** + * Return whether a photo is available + * + * @readonly + * @memberof Contact + */ + get hasPhoto() { + return this.dav && this.dav.hasphoto + } + /** * Return the photo usable url * We cannot fetch external url because of csp policies