fix: open file content in new window when clicking file name in FileItemModal

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.
This commit is contained in:
Athanasios Oikonomou 2026-04-25 14:03:20 +03:00 committed by Athanasios Oikonomou
parent 4e2240aada
commit 7b9e91088d

View file

@ -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'
);