From 2563af31a0f094c09673a8ec23f0b8c6ca20cb88 Mon Sep 17 00:00:00 2001 From: situchan Date: Tue, 19 Mar 2024 13:00:39 +0600 Subject: [PATCH] fix concierge avatar not showing in preview --- src/components/Image/index.tsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/Image/index.tsx b/src/components/Image/index.tsx index 6884966fb81a..f4e5bf4834e0 100644 --- a/src/components/Image/index.tsx +++ b/src/components/Image/index.tsx @@ -11,14 +11,19 @@ function Image({source: propsSource, isAuthTokenRequired = false, session, ...fo * to the source. */ const source = useMemo(() => { - const authToken = session?.encryptedAuthToken ?? null; - if (isAuthTokenRequired && typeof propsSource === 'object' && 'uri' in propsSource && authToken) { - return { - ...propsSource, - headers: { - [CONST.CHAT_ATTACHMENT_TOKEN_KEY]: authToken, - }, - }; + if (typeof propsSource === 'object' && 'uri' in propsSource) { + if (typeof propsSource.uri === 'number') { + return propsSource.uri; + } + const authToken = session?.encryptedAuthToken ?? null; + if (isAuthTokenRequired && authToken) { + return { + ...propsSource, + headers: { + [CONST.CHAT_ATTACHMENT_TOKEN_KEY]: authToken, + }, + }; + } } return propsSource; // The session prop is not required, as it causes the image to reload whenever the session changes. For more information, please refer to issue #26034.