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.
This commit is contained in:
Athanasios Oikonomou
2026-05-08 20:09:35 +03:00
committed by GitHub
parent 6dff85b9d2
commit e451f8f63b

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