From 7d71ea3cb78286fa2ca90592a4d6be48f31dba58 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 21 Aug 2024 12:17:34 +0200 Subject: [PATCH] fix: Fetch also current folder in DAV Regression from the revert. We need to fetch the current folder so we can pick it. Signed-off-by: Ferdinand Thiessen --- lib/composables/dav.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/composables/dav.ts b/lib/composables/dav.ts index 276fe2d2..7d85380d 100644 --- a/lib/composables/dav.ts +++ b/lib/composables/dav.ts @@ -73,7 +73,7 @@ export const useDAVFiles = function( }) } - const getNodes = (): CancelablePromise => { + const getNodes = (): CancelablePromise => { const controller = new AbortController() return new CancelablePromise(async (resolve, reject, onCancel) => { onCancel(() => controller.abort()) @@ -81,14 +81,14 @@ export const useDAVFiles = function( const results = await client.value.getDirectoryContents(`${defaultRootPath}${currentPath.value}`, { signal: controller.signal, details: true, + includeSelf: true, data: davGetDefaultPropfind(), }) as ResponseDataDetailed - let nodes = results.data.map(resultToNode) - // Hack for the public endpoint which always returns folder itself - if (isPublicEndpoint) { - nodes = nodes.filter((file) => file.path !== currentPath.value) - } - resolve(nodes) + const nodes = results.data.map(resultToNode) + resolve({ + folder: nodes.find((file) => file.path === currentPath.value) as Folder, + contents: nodes.filter((file) => file.path !== currentPath.value), + }) } catch (error) { reject(error) }