Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fetch also current folder in DAV #1428

Merged
merged 1 commit into from
Aug 21, 2024
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
Loading