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:
1 parent
6dff85b9d2
commit
e451f8f63b
1 file changed
+3
-2
@@ -266,12 +266,13 @@
|
|||||||
href="#"
|
href="#"
|
||||||
class="hover:underline line-clamp-1"
|
class="hover:underline line-clamp-1"
|
||||||
on:click|preventDefault={() => {
|
on:click|preventDefault={() => {
|
||||||
if (!isPDF && item.url) {
|
if (item.type === 'file' || item.url) {
|
||||||
|
let fileId = item?.id ?? item?.tempId;
|
||||||
window.open(
|
window.open(
|
||||||
item.type === 'file'
|
item.type === 'file'
|
||||||
? item?.url?.startsWith('http')
|
? item?.url?.startsWith('http')
|
||||||
? item.url
|
? item.url
|
||||||
: `${WEBUI_API_BASE_URL}/files/${item.url}/content`
|
: `${WEBUI_API_BASE_URL}/files/${fileId}/content`
|
||||||
: item.url,
|
: item.url,
|
||||||
'_blank'
|
'_blank'
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user