fix: use the join function for merging davRootPath and path

Using the join function ensures, that also paths without a leading slash
a properly merged together. Extracted from
3978e056cf.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2025-08-07 21:56:31 +02:00
parent dbf1b69717
commit ed8bd0a8ef
No known key found for this signature in database
GPG key ID: 4A81C29F63464E8F

View file

@ -7,6 +7,7 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
import { CancelablePromise } from 'cancelable-promise'
import { davGetDefaultPropfind, davResultToNode, davRootPath } from '@nextcloud/files'
import { join } from 'path'
import { client } from './WebdavClient.ts'
import logger from '../logger.ts'
@ -17,11 +18,10 @@ import logger from '../logger.ts'
export const resultToNode = (node: FileStat): Node => davResultToNode(node)
export const getContents = (path = '/'): CancelablePromise<ContentsWithRoot> => {
path = join(davRootPath, path)
const controller = new AbortController()
const propfindPayload = davGetDefaultPropfind()
path = `${davRootPath}${path}`
return new CancelablePromise(async (resolve, reject, onCancel) => {
onCancel(() => controller.abort())
try {