summaryrefslogtreecommitdiffstats
path: root/apps/files/src/services/Favorites.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/services/Favorites.ts')
-rw-r--r--apps/files/src/services/Favorites.ts29
1 files changed, 1 insertions, 28 deletions
diff --git a/apps/files/src/services/Favorites.ts b/apps/files/src/services/Favorites.ts
index c993ef57d33..633ba718560 100644
--- a/apps/files/src/services/Favorites.ts
+++ b/apps/files/src/services/Favorites.ts
@@ -28,6 +28,7 @@ import { getCurrentUser } from '@nextcloud/auth'
import { getClient, rootPath } from './WebdavClient'
import { getDavNameSpaces, getDavProperties, getDefaultPropfind } from './DavProperties'
+import { resultToNode } from './Files'
const client = getClient()
@@ -47,34 +48,6 @@ interface ResponseProps extends DAVResultResponseProps {
size: number,
}
-const resultToNode = function(node: FileStat): File | Folder {
- const props = node.props as ResponseProps
- const permissions = davParsePermissions(props?.permissions)
- const owner = getCurrentUser()?.uid as string
-
- const nodeData = {
- id: props?.fileid as number || 0,
- source: generateRemoteUrl('dav' + rootPath + node.filename),
- mtime: new Date(node.lastmod),
- mime: node.mime as string,
- size: props?.size as number || 0,
- permissions,
- owner,
- root: rootPath,
- attributes: {
- ...node,
- ...props,
- hasPreview: props?.['has-preview'],
- },
- }
-
- delete nodeData.attributes.props
-
- return node.type === 'file'
- ? new File(nodeData)
- : new Folder(nodeData)
-}
-
export const getContents = async (path = '/'): Promise<ContentsWithRoot> => {
const propfindPayload = getDefaultPropfind()