Skip to content

Commit 3fa8479

Browse files
committed
fix(WebDAV): Fix file size check
fixes #1935 Signed-off-by: Marcel Klehr <[email protected]>
1 parent 6a106d6 commit 3fa8479

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/adapters/WebDav.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export default class WebDavAdapter extends CachingAdapter {
220220
Logger.log('Error getting file size: ' + e.message)
221221
}
222222

223-
if (fileSize === null) {
223+
if (fileSize === null || Number.isNaN(fileSize)) {
224224
throw new FileSizeUnknown()
225225
}
226226

@@ -490,7 +490,7 @@ export default class WebDavAdapter extends CachingAdapter {
490490
}
491491

492492
const xml = await res.text()
493-
const match = xml.match(/<.*?:?getcontentlength>(.*?)</)
493+
const match = xml.match(/<.*?:?getcontentlength[^>]*?>(.*?)</)
494494
return match ? parseInt(match[1]) : null
495495
}
496496

@@ -526,7 +526,7 @@ export default class WebDavAdapter extends CachingAdapter {
526526
}
527527

528528
const xml = res.data
529-
const match = xml.match(/<.*?:?getcontentlength>(.*?)</)
529+
const match = xml.match(/<.*?:?getcontentlength[^>]*?>(.*?)</)
530530
return match ? parseInt(match[1]) : null
531531
}
532532

0 commit comments

Comments
 (0)