From 34a53941fbf68ad6163fd13fe4d57cbd6236352d Mon Sep 17 00:00:00 2001 From: John Molakvoæ Date: Sat, 3 Feb 2024 12:39:43 +0100 Subject: fix(files): dav owner and mime types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ Signed-off-by: nextcloud-command Signed-off-by: nextcloud-command --- apps/files/src/services/Files.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apps/files') diff --git a/apps/files/src/services/Files.ts b/apps/files/src/services/Files.ts index a293154f625..bcfb368882d 100644 --- a/apps/files/src/services/Files.ts +++ b/apps/files/src/services/Files.ts @@ -40,9 +40,14 @@ interface ResponseProps extends DAVResultResponseProps { } export const resultToNode = function(node: FileStat): File | Folder { + const userId = getCurrentUser()?.uid + if (!userId) { + throw new Error('No user id found') + } + const props = node.props as ResponseProps const permissions = davParsePermissions(props?.permissions) - const owner = (props['owner-id'] || getCurrentUser()?.uid) as string + const owner = (props['owner-id'] || userId).toString() const source = generateRemoteUrl('dav' + rootPath + node.filename) const id = props?.fileid < 0 @@ -53,7 +58,7 @@ export const resultToNode = function(node: FileStat): File | Folder { id, source, mtime: new Date(node.lastmod), - mime: node.mime as string, + mime: node.mime || 'application/octet-stream', size: props?.size as number || 0, permissions, owner, -- cgit v1.2.3