summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2024-02-03 12:39:43 +0100
committernextcloud-command <nextcloud-command@users.noreply.github.com>2024-02-05 15:24:51 +0000
commit34a53941fbf68ad6163fd13fe4d57cbd6236352d (patch)
tree071c5428a6e7bbfc2e6c06220c1883f3dc49f69f /apps/files
parent7b7df96fd67905e8a5234700ab6f4d0620ce99e9 (diff)
downloadnextcloud-server-34a53941fbf68ad6163fd13fe4d57cbd6236352d.tar.gz
nextcloud-server-34a53941fbf68ad6163fd13fe4d57cbd6236352d.zip
fix(files): dav owner and mime types
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/src/services/Files.ts9
1 files changed, 7 insertions, 2 deletions
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,