Skip to content

Commit

Permalink
fix: Fetch also current folder in DAV
Browse files Browse the repository at this point in the history
Regression from the revert. We need to fetch the current folder so we can pick it.

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Aug 21, 2024
1 parent 95d2f2e commit 7d71ea3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/composables/dav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ export const useDAVFiles = function(
})
}

const getNodes = (): CancelablePromise<Node[]> => {
const getNodes = (): CancelablePromise<ContentsWithRoot> => {
const controller = new AbortController()
return new CancelablePromise(async (resolve, reject, onCancel) => {
onCancel(() => controller.abort())
try {
const results = await client.value.getDirectoryContents(`${defaultRootPath}${currentPath.value}`, {
signal: controller.signal,
details: true,
includeSelf: true,
data: davGetDefaultPropfind(),
}) as ResponseDataDetailed<FileStat[]>
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)
}
Expand Down

0 comments on commit 7d71ea3

Please sign in to comment.