@samitouri / QOSami-HFS / commits / aa58fba7

webdav: partial support for header x-expected-entity-length

Massimo Melina committed Mar 22, 2026 at 11:50 UTC aa58fba700acae90789e7a1b50d1b07c80068bca
1 file changed +3 -2
src/upload.ts
+3 -2
@@ -72,8 +72,9 @@ export function uploadWriter(base: VfsNode, baseUri: string, filename: string, c
72 // enforce minAvailableMb
73 const min = minAvailableMb.get() * (1 << 20)
74 const {simulate} = ctx.query // `simulate` is used to get the same error but with an empty body, so that the request is processed quickly
75 - const contentLength = Number(simulate || ctx.headers["content-length"])
76 - const isPartial = ctx.query.partial !== undefined // while the presence of "partial" conveys the upload is split...
75 + const contentLength = Number(simulate ?? ctx.headers["content-length"]
76 + ?? ctx.headers['x-expected-entity-length']) // some webdav clients send this; it's not equivalent to content-length, but can get the job done in some cases
77 + const isPartial = ctx.query.partial !== undefined // while the presence of "partial" conveys that the upload is split...
78 const stillToWrite = Math.max(contentLength, Number(ctx.query.partial) || 0) // ...the number is used to tell how much space we need (fullSize - offset)
79 if (isNaN(stillToWrite)) {
80 if (min)