diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 864f1642f..86d3d3305 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -535,32 +535,37 @@ public class OSSService : IOSSService .WithSSL(minIOConfig.UseSSL) .Build(); - var pipe = new System.IO.Pipelines.Pipe(); + #region 废弃3 - _ = Task.Run(async () => - { - try - { - var args = new GetObjectArgs() - .WithBucket(minIOConfig.BucketName) - .WithObject(ossRelativePath) - .WithCallbackStream(async source => - { - await source.CopyToAsync(pipe.Writer.AsStream()); - await pipe.Writer.FlushAsync(); - }); + //var pipe = new System.IO.Pipelines.Pipe(); + + //_ = Task.Run(async () => + //{ + // try + // { + // var args = new GetObjectArgs() + // .WithBucket(minIOConfig.BucketName) + // .WithObject(ossRelativePath) + // .WithCallbackStream(async source => + // { + // await source.CopyToAsync(pipe.Writer.AsStream()); + // await pipe.Writer.FlushAsync(); + // }); + + // await minioClient.GetObjectAsync(args); + // } + // finally + // { + // await pipe.Writer.CompleteAsync(); + // } + //}); + + //return pipe.Reader.AsStream(); + + #endregion - await minioClient.GetObjectAsync(args); - } - finally - { - await pipe.Writer.CompleteAsync(); - } - }); - return pipe.Reader.AsStream(); - #region 废弃2 //var pipe = new System.IO.Pipelines.Pipe(); @@ -594,16 +599,16 @@ public class OSSService : IOSSService #region 废弃 - //var memoryStream = new MemoryStream(); + var memoryStream = new MemoryStream(); - //var getObjectArgs = new GetObjectArgs() - // .WithBucket(minIOConfig.BucketName) - // .WithObject(ossRelativePath) - // .WithCallbackStream(stream => stream.CopyToAsync(memoryStream)); + var getObjectArgs = new GetObjectArgs() + .WithBucket(minIOConfig.BucketName) + .WithObject(ossRelativePath) + .WithCallbackStream(stream => stream.CopyToAsync(memoryStream)); - //await minioClient.GetObjectAsync(getObjectArgs); - //memoryStream.Position = 0; - //return memoryStream; + await minioClient.GetObjectAsync(getObjectArgs); + memoryStream.Position = 0; + return memoryStream; #endregion