From 49cbc9314e313ea29e4919fbe1f7de985ed2c210 Mon Sep 17 00:00:00 2001 From: flfeders Date: Sun, 9 Aug 2026 18:15:37 +0200 Subject: [PATCH] Handle files without stored paths --- frontend/components/DocumentDisplayModal.vue | 2 +- frontend/pages/files/index.vue | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/components/DocumentDisplayModal.vue b/frontend/components/DocumentDisplayModal.vue index 9b625fa..cad77bc 100644 --- a/frontend/components/DocumentDisplayModal.vue +++ b/frontend/components/DocumentDisplayModal.vue @@ -152,7 +152,7 @@ setup()
{ }) // --- Data Mapping --- +const getFileName = (file) => { + const path = String(file?.path || '').trim() + return path ? path.split('/').pop() : `Datei ${file?.id || ''}`.trim() +} + const renderedFileList = computed(() => { const folderList = folders.value .filter(i => currentFolder.value ? i.parent === currentFolder.value.id : !i.parent) @@ -243,7 +248,7 @@ const renderedFileList = computed(() => { const fileList = documents.value .filter(i => currentFolder.value ? i.folder === currentFolder.value.id : !i.folder) - .map(i => ({...i, label: i.path.split("/").pop(), type: "file"})) + .map(i => ({...i, label: getFileName(i), type: "file"})) .sort((a, b) => a.label.localeCompare(b.label)) let combined = [...folderList, ...fileList] @@ -315,7 +320,7 @@ const updateName = async () => { await useEntities("folders").update(renameData.value.id, {name: renameData.value.name}) } else { const file = documents.value.find(d => d.id === renameData.value.id) - const pathParts = file.path.split('/') + const pathParts = String(file?.path || '').split('/') pathParts[pathParts.length - 1] = renameData.value.name await useEntities("files").update(renameData.value.id, {path: pathParts.join('/')}) }