Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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