diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 4f7f12646..864f1642f 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -544,22 +544,23 @@ public class OSSService : IOSSService var args = new GetObjectArgs() .WithBucket(minIOConfig.BucketName) .WithObject(ossRelativePath) - .WithCallbackStream(stream => + .WithCallbackStream(async source => { - stream.CopyTo(pipe.Writer.AsStream()); + await source.CopyToAsync(pipe.Writer.AsStream()); + await pipe.Writer.FlushAsync(); }); await minioClient.GetObjectAsync(args); - await pipe.Writer.CompleteAsync(); } - catch (Exception ex) + finally { - await pipe.Writer.CompleteAsync(ex); + await pipe.Writer.CompleteAsync(); } }); return pipe.Reader.AsStream(); + #region 废弃2 //var pipe = new System.IO.Pipelines.Pipe();