From e451f8f63b88dc46ab51de5f43319028248ee49f Mon Sep 17 00:00:00 2001 From: Athanasios Oikonomou Date: Fri, 8 May 2026 20:09:35 +0300 Subject: [PATCH] fix: open file content in new window when clicking file name in FileItemModal (#24125) Previously, clicking the file name link did not open the file content because the condition checked `!isPDF && item.url`, which failed for `type === 'file'` items that use an ID-based URL path. Update the condition to trigger on `item.type === 'file' || item.url`, and resolve the correct URL by extracting `fileId` from `item.id` or `item.tempId` instead of using `item.url` directly as the file identifier. --- src/lib/components/common/FileItemModal.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/components/common/FileItemModal.svelte b/src/lib/components/common/FileItemModal.svelte index 4767cf92cb..2fb6a16bad 100644 --- a/src/lib/components/common/FileItemModal.svelte +++ b/src/lib/components/common/FileItemModal.svelte @@ -266,12 +266,13 @@ href="#" class="hover:underline line-clamp-1" on:click|preventDefault={() => { - if (!isPDF && item.url) { + if (item.type === 'file' || item.url) { + let fileId = item?.id ?? item?.tempId; window.open( item.type === 'file' ? item?.url?.startsWith('http') ? item.url - : `${WEBUI_API_BASE_URL}/files/${item.url}/content` + : `${WEBUI_API_BASE_URL}/files/${fileId}/content` : item.url, '_blank' );