mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
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:
committed by
GitHub
parent
6dff85b9d2
commit
e451f8f63b
@@ -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'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user