diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index 1c345f1f..86e44b4c 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -141,6 +141,7 @@ class WebDavClient { Map? _generateUploadHeaders({ required final DateTime? lastModified, required final DateTime? created, + required final int? contentLength, }) { final headers = { if (lastModified != null) ...{ @@ -149,6 +150,9 @@ class WebDavClient { if (created != null) ...{ 'X-OC-CTime': (created.millisecondsSinceEpoch ~/ 1000).toString(), }, + if (contentLength != null) ...{ + 'Content-Length': contentLength.toString(), + }, }; return headers.isNotEmpty ? headers : null; } @@ -168,6 +172,7 @@ class WebDavClient { headers: _generateUploadHeaders( lastModified: lastModified, created: created, + contentLength: localData.lengthInBytes, ), ); @@ -177,6 +182,7 @@ class WebDavClient { final String remotePath, { final DateTime? lastModified, final DateTime? created, + final int? contentLength, }) async => _send( 'PUT', @@ -186,6 +192,7 @@ class WebDavClient { headers: _generateUploadHeaders( lastModified: lastModified, created: created, + contentLength: contentLength, ), );