From b0f1266a8b34337503b292f6c48e1e21863ae3d2 Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Fri, 9 Jan 2026 12:02:42 -0500 Subject: [PATCH] feat: normalize paths + add share for crash reports (#5071) --- .../ui/src/components/servers/files/FileNavbar.vue | 6 +++++- .../components/servers/files/editor/FileEditor.vue | 14 ++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/ui/src/components/servers/files/FileNavbar.vue b/packages/ui/src/components/servers/files/FileNavbar.vue index 2dfcf15e..cac7ac2e 100644 --- a/packages/ui/src/components/servers/files/FileNavbar.vue +++ b/packages/ui/src/components/servers/files/FileNavbar.vue @@ -199,7 +199,11 @@ defineEmits<{ }>() const isLogFile = computed(() => { - return props.editingFilePath?.startsWith('logs') || props.editingFilePath?.endsWith('.log') + return ( + props.editingFilePath?.startsWith('logs') || + props.editingFilePath?.startsWith('crash-reports') || + props.editingFilePath?.endsWith('.log') + ) }) diff --git a/packages/ui/src/components/servers/files/editor/FileEditor.vue b/packages/ui/src/components/servers/files/editor/FileEditor.vue index 98793b98..340879d1 100644 --- a/packages/ui/src/components/servers/files/editor/FileEditor.vue +++ b/packages/ui/src/components/servers/files/editor/FileEditor.vue @@ -92,18 +92,23 @@ async function loadFileContent(file: { name: string; type: string; path: string try { window.scrollTo(0, 0) const extension = getFileExtension(file.name) + const normalizedPath = file.path.startsWith('/') ? file.path : `/${file.path}` if (file.type === 'file' && isImageFile(extension)) { - const content = await client.kyros.files_v0.downloadFile(file.path) + const content = await client.kyros.files_v0.downloadFile(normalizedPath) isEditingImage.value = true imagePreview.value = content } else { isEditingImage.value = false - const cachedContent = queryClient.getQueryData(['file-content', serverId, file.path]) + const cachedContent = queryClient.getQueryData([ + 'file-content', + serverId, + normalizedPath, + ]) if (cachedContent) { fileContent.value = cachedContent } else { - const content = await client.kyros.files_v0.downloadFile(file.path) + const content = await client.kyros.files_v0.downloadFile(normalizedPath) fileContent.value = await content.text() } } @@ -148,7 +153,8 @@ async function saveFileContent(exit: boolean = true) { if (!props.file) return try { - await client.kyros.files_v0.updateFile(props.file.path, fileContent.value) + const normalizedPath = props.file.path.startsWith('/') ? props.file.path : `/${props.file.path}` + await client.kyros.files_v0.updateFile(normalizedPath, fileContent.value) if (exit) { await queryClient.invalidateQueries({ queryKey: ['servers', 'detail', serverId] })