Skip to content

Commit

Permalink
Fallback to unknown photo mimetype
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Apr 8, 2019
1 parent b362ada commit 6a9025c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/ContactsList/ContactsListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export default {
},
avatarUrl() {
if (this.contact.photo) {
const type = this.contact.vCard.getFirstProperty('photo').type
if (!this.contact.photo.startsWith('data') && type === 'binary') {
// split on coma in case of any leftover base64 data and retrieve last part
// usually we come to this part when the base64 image type is unknown
return `url(data:image;base64,${this.contact.photo.split(',').pop()})`
}
return `url(${this.contact.photo})`
}
return `url(${this.contact.url}?photo)`
Expand Down

0 comments on commit 6a9025c

Please sign in to comment.