diff --git a/CHANGELOG.md b/CHANGELOG.md index 8968530435a3c28d3a0f53ff20f5101757310c03..284ce85daea31418a13b6954063e393fb5bc5bb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +# 3.4.0-pre +- Better upload progress on web # 3.3.3 - Fix empty upload error - Update README.md diff --git a/lib/src/minio_client.dart b/lib/src/minio_client.dart index 9361ea1d976f3c3420f12ddb44f008c6279c6821..3fff503722c799eb2d64725e6533ebedd73f167e 100644 --- a/lib/src/minio_client.dart +++ b/lib/src/minio_client.dart @@ -24,29 +24,29 @@ class MinioRequest extends BaseRequest { return const ByteStream(Stream.empty()); } - if (body is Stream<Uint8List>) { - return ByteStream(body); - } - late Stream<Uint8List> stream; - if (body is String) { + if (body is Stream<Uint8List>) { + stream = body; + } else if (body is String) { final data = Utf8Encoder().convert(body); headers['content-length'] = data.length.toString(); stream = Stream<Uint8List>.value(data); } else if (body is Uint8List) { stream = Stream<Uint8List>.value(body); headers['content-length'] = body.length.toString(); + } else { + throw UnsupportedError('Unsupported body type: ${body.runtimeType}'); } - stream = stream.transform(MaxChunkSize(1 << 16)); - if (onProgress == null) { return ByteStream(stream); } var bytesRead = 0; + stream = stream.transform(MaxChunkSize(1 << 16)); + return ByteStream( stream.transform( StreamTransformer.fromHandlers( diff --git a/pubspec.yaml b/pubspec.yaml index f4c483eea1b1c87a894c916ad8fddc5b736e393f..377feccac98e3e9d60f5ec95c56828956d107b34 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: minio description: Unofficial MinIO Dart Client SDK that provides simple APIs to access any Amazon S3 compatible object storage server. -version: 3.3.3 +version: 3.4.0-pre homepage: https://github.com/xtyxtyx/minio-dart issue_tracker: https://github.com/xtyxtyx/minio-dart/issues