Skip to content

Commit

Permalink
Merge pull request #1993 from nextcloud/docs/nextcloud/webdav-clarify…
Browse files Browse the repository at this point in the history
…-put-content-length-importance
  • Loading branch information
provokateurin authored May 1, 2024
2 parents f6e645e + d99101c commit 1d647e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/neon/neon_files/lib/src/utils/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class FilesUploadTaskMemory extends FilesTaskMemory implements FilesUploadTask {
}

@override
final int? size;
final int size;

@override
final tz.TZDateTime? lastModified;
Expand All @@ -138,6 +138,7 @@ class FilesUploadTaskMemory extends FilesTaskMemory implements FilesUploadTask {
_stream.stream,
uri,
lastModified: lastModified,
contentLength: size,
onProgress: progressController.add,
);
await progressController.close();
Expand Down
6 changes: 6 additions & 0 deletions packages/nextcloud/lib/src/webdav/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 1d647e7

Please sign in to comment.