Skip to content

Commit

Permalink
fix: check if photo property is set before downloading
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
  • Loading branch information
SebastianKrupinski committed Dec 13, 2024
1 parent b91012f commit f33c353
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/ContactsList/ContactsListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
},
Expand Down
10 changes: 10 additions & 0 deletions src/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ export default class Contact {
this.vCard.updatePropertyWithValue('photo', photo)
}

/**
* Return whether a photo is available
*
* @readonly
* @memberof Contact
*/
get hasPhoto() {

Check warning on line 218 in src/models/contact.js

View check run for this annotation

Codecov / codecov/patch

src/models/contact.js#L218

Added line #L218 was not covered by tests
return this.dav && this.dav.hasphoto
}

/**
* Return the photo usable url
* We cannot fetch external url because of csp policies
Expand Down

0 comments on commit f33c353

Please sign in to comment.