fix(avatar) support icons alongside cors avatars (#12280)

This commit is contained in:
Mihaela Dumitru 2022-09-30 17:51:16 +03:00 committed by GitHub
parent 93406bb12c
commit 1230cebde2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -76,6 +76,6 @@ export function getInitials(s?: string) {
* @param {Array<string>} corsURLs - The URL pattern that matches a URL that needs to be handled with CORS. * @param {Array<string>} corsURLs - The URL pattern that matches a URL that needs to be handled with CORS.
* @returns {void} * @returns {void}
*/ */
export function isCORSAvatarURL(url: string | any = '', corsURLs: Array<string> = []) { export function isCORSAvatarURL(url: string, corsURLs: Array<string> = []): boolean {
return corsURLs.some(pattern => url.startsWith(pattern)); return corsURLs.some(pattern => url.startsWith(pattern));
} }

View File

@ -609,7 +609,8 @@ async function _getFirstLoadableAvatarUrl(participant: Participant, store: IStor
} else { } else {
try { try {
const { corsAvatarURLs } = store.getState()['features/base/config']; 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, { AVATAR_CHECKED_URLS.set(src, {
isLoadable: true, isLoadable: true,