Handle files without stored paths
All checks were successful
Build and Push Docker Images / build-frontend (push) Successful in 1m54s
Build and Push Docker Images / build-website (push) Successful in 37s
Build and Push Docker Images / build-backend (push) Successful in 36s
Build and Push Docker Images / build-central-services-api (push) Successful in 35s
Build and Push Docker Images / build-central-services-admin (push) Successful in 34s
Build and Push Docker Images / build-docs (push) Successful in 34s

This commit is contained in:
2026-08-09 18:15:37 +02:00
parent e5fab70056
commit 49cbc9314e
2 changed files with 8 additions and 3 deletions

View File

@@ -152,7 +152,7 @@ setup()
<div class="flex flex-row">
<div class="w-1/3">
<PDFViewer
v-if="props.documentData.id && props.documentData.path.toLowerCase().includes('pdf')"
v-if="props.documentData.id && String(props.documentData.path || '').toLowerCase().includes('pdf')"
:file-id="props.documentData.id" />
<img

View File

@@ -235,6 +235,11 @@ const breadcrumbItems = computed(() => {
})
// --- 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('/')})
}