From eb348c78752b88fa6efa60b3c35082f16e6b1381 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 d46888a33..51c971273 100644 --- a/src/components/ContactsList/ContactsListItem.vue +++ b/src/components/ContactsList/ContactsListItem.vue @@ -116,7 +116,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 67cc23270..391375e0b 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -226,6 +226,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