From 5df701df3fc1fd02898a375e5f1cbe3af7c52a2c Mon Sep 17 00:00:00 2001 From: Cyril Gromoff Date: Wed, 4 Sep 2024 14:01:18 +0200 Subject: [PATCH] fix: enable preview for all image types without initial or mini preview Changelog: fixed --- .../thread_item/attachments/file_card/file_card.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webapp/channels/src/components/threading/global_threads/thread_item/attachments/file_card/file_card.tsx b/webapp/channels/src/components/threading/global_threads/thread_item/attachments/file_card/file_card.tsx index 5042496642..c970b4c54b 100644 --- a/webapp/channels/src/components/threading/global_threads/thread_item/attachments/file_card/file_card.tsx +++ b/webapp/channels/src/components/threading/global_threads/thread_item/attachments/file_card/file_card.tsx @@ -8,7 +8,7 @@ import type {FileInfo} from '@mattermost/types/files'; import {getFileThumbnailUrl, getFileUrl} from 'mattermost-redux/utils/file_utils'; -import {FileTypes} from 'utils/constants'; +import Constants, {FileTypes} from 'utils/constants'; import {fileSizeToString, getCompassIconClassName, getFileType} from 'utils/utils'; import './file_card.scss'; @@ -37,6 +37,10 @@ function File({ enableSVGs, }: FileProps) { const imgSrc = useMemo(() => { + // Infomaniak > all images type from constants.IMAGE_TYPES can preview if they have not initial image preview and mini preview. + if (Constants.IMAGE_TYPES.includes(extension.toLowerCase()) && !hasPreviewImage && !miniPreview) { + return getFileUrl(id); + } if (!hasPreviewImage) { return undefined; }