diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index 1bce6929..d1aa4952 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -164,16 +164,12 @@ class WebDavClient { final DateTime? lastModified, final DateTime? created, }) => - _send( - 'PUT', - _constructPath(remotePath), - [200, 201, 204], - data: Stream.value(localData), - headers: _generateUploadHeaders( - lastModified: lastModified, - created: created, - contentLength: localData.lengthInBytes, - ), + uploadStream( + Stream.value(localData), + remotePath, + lastModified: lastModified, + created: created, + contentLength: localData.lengthInBytes, ); /// upload a new file with [localData] as content to [remotePath] @@ -197,15 +193,8 @@ class WebDavClient { ); /// download [remotePath] and store the response file contents to String - Future download(final String remotePath) async => Uint8List.fromList( - (await (await _send( - 'GET', - _constructPath(remotePath), - [200], - )) - .join()) - .codeUnits, - ); + Future download(final String remotePath) async => + Uint8List.fromList((await (await downloadStream(remotePath)).join()).codeUnits); /// download [remotePath] and store the response file contents to ByteStream Future downloadStream(final String remotePath) async => _send(