diff --git a/packages/web-app-files/tests/unit/helpers/resource/resourcesTransfer.spec.ts b/packages/web-app-files/tests/unit/helpers/resource/resourcesTransfer.spec.ts index bc96e54c41a..5ca70737831 100644 --- a/packages/web-app-files/tests/unit/helpers/resource/resourcesTransfer.spec.ts +++ b/packages/web-app-files/tests/unit/helpers/resource/resourcesTransfer.spec.ts @@ -6,7 +6,7 @@ import { resolveFileNameDuplicate } from '../../../../src/helpers/resource' import { mockDeep, mockReset } from 'jest-mock-extended' -import { buildSpace, PropfindResult, Resource } from 'web-client/src/helpers' +import { buildSpace, ListFilesResult, Resource } from 'web-client/src/helpers' const clientServiceMock = mockDeep() let resourcesToMove @@ -77,7 +77,7 @@ describe('resourcesTransfer', () => { const propfindResult = { resource: {} as Resource, children: [] as Resource[] - } as PropfindResult + } as ListFilesResult clientServiceMock.webdav.listFiles.mockReturnValueOnce( new Promise((resolve) => resolve(propfindResult)) ) diff --git a/packages/web-client/src/helpers/space/types.ts b/packages/web-client/src/helpers/space/types.ts index a05e7cf07a2..a26f205d0b3 100644 --- a/packages/web-client/src/helpers/space/types.ts +++ b/packages/web-client/src/helpers/space/types.ts @@ -76,7 +76,7 @@ export const isPublicSpaceResource = (resource: Resource): resource is PublicSpa return resource.driveType === 'public' } -export interface PropfindResult { +export interface ListFilesResult { resource: Resource children?: Resource[] } diff --git a/packages/web-client/src/webdav/listFiles.ts b/packages/web-client/src/webdav/listFiles.ts index 6e197cc0379..7b053035621 100644 --- a/packages/web-client/src/webdav/listFiles.ts +++ b/packages/web-client/src/webdav/listFiles.ts @@ -3,7 +3,7 @@ import { DavProperties, DavProperty } from './constants' import { buildPublicSpaceResource, isPublicSpaceResource, - PropfindResult, + ListFilesResult, SpaceResource } from '../helpers' import { WebDavOptions } from './types' @@ -20,7 +20,7 @@ export const ListFilesFactory = ({ sdk }: WebDavOptions) => { space: SpaceResource, { path, fileId }: { path?: string; fileId?: string | number } = {}, { depth = 1, davProperties }: ListFilesOptions = {} - ): Promise { + ): Promise { let webDavResources: any[] if (isPublicSpaceResource(space)) { webDavResources = await sdk.publicFiles.list( @@ -47,10 +47,10 @@ export const ListFilesFactory = ({ sdk }: WebDavOptions) => { return { resource: buildPublicSpaceResource(rootFolder), children: children.map(buildResource) - } as PropfindResult + } as ListFilesResult } const resources = webDavResources.map(buildResource) - return { resource: resources[0], children: resources.slice(1) } as PropfindResult + return { resource: resources[0], children: resources.slice(1) } as ListFilesResult } const listFilesCorrectedPath = async () => { @@ -68,7 +68,7 @@ export const ListFilesFactory = ({ sdk }: WebDavOptions) => { if (fileId && fileId !== resources[0].fileId) { return listFilesCorrectedPath() } - return { resource: resources[0], children: resources.slice(1) } as PropfindResult + return { resource: resources[0], children: resources.slice(1) } as ListFilesResult } catch (e) { if (e.statusCode === 404 && fileId) { return listFilesCorrectedPath()