Compare commits

...

2 Commits

Author SHA1 Message Date
hang 8e2d04808f Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is failing Details
2026-06-05 17:50:34 +08:00
hang dc1f95c75e minio 获取流调整 2026-06-05 17:50:32 +08:00
1 changed files with 9 additions and 0 deletions

View File

@ -1206,14 +1206,21 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
var minIOConfig = ObjectStoreServiceOptions.MinIO;
var minioClient = new MinioClient()
.WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}")
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey)
.WithSSL(minIOConfig.UseSSL)
.WithHttpClient(new HttpClient(httpClientHandler))
.Build();
var pipe = new System.IO.Pipelines.Pipe();
_ = Task.Run(async () =>
@ -1226,6 +1233,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
.WithCallbackStream(stream =>
{
stream.CopyTo(pipe.Writer.AsStream());
pipe.Writer.FlushAsync();
});
await minioClient.GetObjectAsync(args);
@ -1233,6 +1241,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
}
catch (Exception ex)
{
Log.Error($"minio 获取流错误:{ex.Message}");
await pipe.Writer.CompleteAsync(ex);
}
});