From 9aadb283e79c5afc2ac2155419b3bb4c9330caf0 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 25 Jul 2024 00:42:51 +0200 Subject: [PATCH] fix(dav): Cast displayname to string in `resultToNode` There is a bug in the webdav library that will cause e.g. `1` as a name to be interpreted as the number 1. Signed-off-by: Ferdinand Thiessen --- lib/dav/dav.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dav/dav.ts b/lib/dav/dav.ts index 2f6ca335..1b4c5a71 100644 --- a/lib/dav/dav.ts +++ b/lib/dav/dav.ts @@ -179,7 +179,8 @@ export const davResultToNode = function(node: FileStat, filesRoot = davRootPath, source: `${remoteURL}${node.filename}`, mtime: new Date(Date.parse(node.lastmod)), mime: node.mime || 'application/octet-stream', - displayname: props.displayname, + // Manually cast to work around for https://github.com/perry-mitchell/webdav-client/pull/380 + displayname: props.displayname !== undefined ? String(props.displayname) : undefined, size: props?.size || Number.parseInt(props.getcontentlength || '0'), // The fileid is set to -1 for failed requests status: id < 0 ? NodeStatus.FAILED : undefined,