From a545b8003fc6357fd696d7903158f0c9209464dd Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 18 Aug 2023 14:58:41 +0200 Subject: [PATCH] fix(nextcloud): Fix WebDAV progress Signed-off-by: jld3103 --- packages/nextcloud/lib/src/webdav/client.dart | 4 ++-- packages/nextcloud/test/webdav_test.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index fa05a74a..88a10b53 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -187,7 +187,7 @@ class WebDavClient { return putStream( file.openRead().map((final chunk) { uploaded += chunk.length; - onProgress?.call(uploaded / fileStat.size * 100); + onProgress?.call(uploaded / fileStat.size); return Uint8List.fromList(chunk); }), path, @@ -221,7 +221,7 @@ class WebDavClient { response.listen((final chunk) async { sink.add(chunk); downloaded += chunk.length; - onProgress?.call(downloaded / response.contentLength * 100); + onProgress?.call(downloaded / response.contentLength); if (downloaded >= response.contentLength) { completer.complete(); } diff --git a/packages/nextcloud/test/webdav_test.dart b/packages/nextcloud/test/webdav_test.dart index ef7391ec..bf6ac30b 100644 --- a/packages/nextcloud/test/webdav_test.dart +++ b/packages/nextcloud/test/webdav_test.dart @@ -301,7 +301,7 @@ void main() { destination, onProgress: progressValues.add, ); - expect(progressValues, containsAll([100.0, 100.0])); + expect(progressValues, containsAll([1.0, 1.0])); expect(destination.readAsBytesSync(), source.readAsBytesSync()); destinationDir.deleteSync(recursive: true);