Skip to content

Commit

Permalink
Merge pull request #1428 from nextcloud-libraries/fix/stable5-content…
Browse files Browse the repository at this point in the history
…-with-root
  • Loading branch information
skjnldsv authored Aug 21, 2024
2 parents 95d2f2e + 7d71ea3 commit 6c5c29b
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 6c5c29b

Please sign in to comment.