From 6017f6d7d26dbd63ad258ea8404305176f1aa199 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 30 Apr 2024 12:21:14 +0200 Subject: [PATCH 1/2] docs(nextcloud): Clarify why setting Content-Length for WebDAV PUT requests is important Signed-off-by: provokateurin --- packages/nextcloud/lib/src/webdav/client.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index 50b09c25139..db1628c4527 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -142,6 +142,9 @@ class WebDavClient { /// Request to put a new file at [path] with [localData] as content. /// + /// Setting [contentLength] is important because some web servers will consider the file to be empty otherwise. + /// It will be required in the next major release. + /// /// See: /// * [putStream] for a complete operation executing this request. http.BaseRequest putStream_Request( @@ -187,6 +190,9 @@ class WebDavClient { /// [created] sets the date when the file was created on the server. /// [contentLength] sets the length of the [localData] that is uploaded. /// [onProgress] can be used to watch the upload progress. Possible values range from 0.0 to 1.0. [contentLength] needs to be set for it to work. + /// Setting [contentLength] is important because some web servers will consider the file to be empty otherwise. + /// It will be required in the next major release. + /// /// See: /// * http://www.webdav.org/specs/rfc2518.html#METHOD_PUT for more information. /// * [putStream_Request] for the request sent by this method. From d99101c487b375d7d1ceff31491a0104f6b4e2ef Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 30 Apr 2024 12:21:40 +0200 Subject: [PATCH 2/2] fix(neon_files): Pass file size when uploading from memory Signed-off-by: provokateurin --- packages/neon/neon_files/lib/src/utils/task.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/neon/neon_files/lib/src/utils/task.dart b/packages/neon/neon_files/lib/src/utils/task.dart index dbe8270161f..e86200a1285 100644 --- a/packages/neon/neon_files/lib/src/utils/task.dart +++ b/packages/neon/neon_files/lib/src/utils/task.dart @@ -128,7 +128,7 @@ class FilesUploadTaskMemory extends FilesTaskMemory implements FilesUploadTask { } @override - final int? size; + final int size; @override final tz.TZDateTime? lastModified; @@ -138,6 +138,7 @@ class FilesUploadTaskMemory extends FilesTaskMemory implements FilesUploadTask { _stream.stream, uri, lastModified: lastModified, + contentLength: size, onProgress: progressController.add, ); await progressController.close();