Skip to content

Commit

Permalink
Merge pull request #186 from adobe/issue-185
Browse files Browse the repository at this point in the history
fix: sharepoint avatar cannot be loaded
  • Loading branch information
rofe authored Nov 21, 2022
2 parents c96384a + 8eb7b89 commit bee2cc0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/extension/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -1460,9 +1460,18 @@
function checkUserState(sk) {
const toggle = sk.get('user').firstElementChild;
toggle.removeAttribute('disabled');
const updateUserPicture = (picture) => {
const updateUserPicture = async (picture) => {
toggle.querySelectorAll('.user-picture').forEach((img) => img.remove());
if (picture) {
if (picture.startsWith('https://admin.hlx.page/')) {
// fetch the image with auth token
const resp = await fetch(picture, {
headers: {
'x-auth-token': sk.config.authToken,
},
});
picture = URL.createObjectURL(await resp.blob());
}
toggle.querySelector('.user-icon').classList.add('user-icon-hidden');
appendTag(toggle, {
tag: 'img',
Expand Down

0 comments on commit bee2cc0

Please sign in to comment.