From 1230cebde2b0dd31d5de488412ce1e233d18e462 Mon Sep 17 00:00:00 2001 From: Mihaela Dumitru Date: Fri, 30 Sep 2022 17:51:16 +0300 Subject: [PATCH] fix(avatar) support icons alongside cors avatars (#12280) --- react/features/base/avatar/functions.ts | 2 +- react/features/base/participants/functions.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/react/features/base/avatar/functions.ts b/react/features/base/avatar/functions.ts index 07fd05e1d..accecd4d2 100644 --- a/react/features/base/avatar/functions.ts +++ b/react/features/base/avatar/functions.ts @@ -76,6 +76,6 @@ export function getInitials(s?: string) { * @param {Array} corsURLs - The URL pattern that matches a URL that needs to be handled with CORS. * @returns {void} */ -export function isCORSAvatarURL(url: string | any = '', corsURLs: Array = []) { +export function isCORSAvatarURL(url: string, corsURLs: Array = []): boolean { return corsURLs.some(pattern => url.startsWith(pattern)); } diff --git a/react/features/base/participants/functions.ts b/react/features/base/participants/functions.ts index 9bf595c19..f7ce82109 100644 --- a/react/features/base/participants/functions.ts +++ b/react/features/base/participants/functions.ts @@ -609,7 +609,8 @@ async function _getFirstLoadableAvatarUrl(participant: Participant, store: IStor } else { try { const { corsAvatarURLs } = store.getState()['features/base/config']; - const { isUsingCORS, src } = await preloadImage(url, isCORSAvatarURL(url, corsAvatarURLs)); + const useCORS = isIconUrl(url) ? false : isCORSAvatarURL(url, corsAvatarURLs); + const { isUsingCORS, src } = await preloadImage(url, useCORS); AVATAR_CHECKED_URLS.set(src, { isLoadable: true,