From f15ba46957bdae8639f419f14794792c534718db Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 19 Mar 2024 11:18:05 -0700 Subject: [PATCH] Merge pull request #38554 from situchan/fix-38516 [CP Staging] fix concierge avatar not showing in preview (cherry picked from commit 0d700c31dfadce758d4a623789e6bd1857573131) --- 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.