Skip to content

Commit

Permalink
fix(dav): Cast displayname to string in resultToNode
Browse files Browse the repository at this point in the history
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 <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jul 24, 2024
1 parent 29ba544 commit 9aadb28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/dav/dav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9aadb28

Please sign in to comment.