Skip to content

Commit 6c5c29b

Browse files
authored
Merge pull request #1428 from nextcloud-libraries/fix/stable5-content-with-root
2 parents 95d2f2e + 7d71ea3 commit 6c5c29b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/composables/dav.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,22 @@ export const useDAVFiles = function(
7373
})
7474
}
7575

76-
const getNodes = (): CancelablePromise<Node[]> => {
76+
const getNodes = (): CancelablePromise<ContentsWithRoot> => {
7777
const controller = new AbortController()
7878
return new CancelablePromise(async (resolve, reject, onCancel) => {
7979
onCancel(() => controller.abort())
8080
try {
8181
const results = await client.value.getDirectoryContents(`${defaultRootPath}${currentPath.value}`, {
8282
signal: controller.signal,
8383
details: true,
84+
includeSelf: true,
8485
data: davGetDefaultPropfind(),
8586
}) as ResponseDataDetailed<FileStat[]>
86-
let nodes = results.data.map(resultToNode)
87-
// Hack for the public endpoint which always returns folder itself
88-
if (isPublicEndpoint) {
89-
nodes = nodes.filter((file) => file.path !== currentPath.value)
90-
}
91-
resolve(nodes)
87+
const nodes = results.data.map(resultToNode)
88+
resolve({
89+
folder: nodes.find((file) => file.path === currentPath.value) as Folder,
90+
contents: nodes.filter((file) => file.path !== currentPath.value),
91+
})
9292
} catch (error) {
9393
reject(error)
9494
}

0 commit comments

Comments
 (0)