From 930589fd4b496a9123299a2600a635e37f709fe7 Mon Sep 17 00:00:00 2001 From: tinkerish Date: Tue, 13 Jan 2026 14:40:27 +0530 Subject: [PATCH] Add regression test for external image preview loading --- .../file_preview_modal.test.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webapp/channels/src/components/file_preview_modal/file_preview_modal.test.tsx b/webapp/channels/src/components/file_preview_modal/file_preview_modal.test.tsx index e3b312c3efc..fdc6c2dff71 100644 --- a/webapp/channels/src/components/file_preview_modal/file_preview_modal.test.tsx +++ b/webapp/channels/src/components/file_preview_modal/file_preview_modal.test.tsx @@ -295,4 +295,24 @@ describe('components/FilePreviewModal', () => { expect(wrapper).toMatchSnapshot(); }); + + test('should be marked as loaded immediately to avoid infinite loading of external images', () => { + + const externalImageUrl = 'http://localhost:8065/api/v4/image?url=https%3A%2F%2Fexample.com%2Fimage.jpg'; + + const fileInfos = [{ + has_preview_image: false, + link: externalImageUrl, + extension: '', + name: 'External Image', + }]; + + const props = {...baseProps, fileInfos}; + const wrapper = shallow(); + + wrapper.instance().loadImage(0); + + expect(wrapper.state('loaded')[0]).toBe(true); + }); + });