You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue follows on from my previous issue #673 , its the same code but a different path through to the issue
I am using the following code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Minio;
namespace MinioClientTest
{
class Program
{
static async Task Main()
{
var minIoClient = new MinioClient().WithEndpoint("localhost:9000").WithCredentials("LocalaccessKey", "localSecretKey").Build();
var amazonClient = new MinioClient().WithEndpoint("s3.amazonaws.com").WithCredentials("s3AccessKey", "s3AccessSecret").WithSSL().WithRegion("eu-west-2").Build();
var minIoSourceBucket = "default";
var minIoSourceFilePath = "SomeLogFile.txt";
var amazonSinkBucket = "SomeBucket";
var amazonSinkFilePath = "SomeLogFile.txt";
var getArgs = new GetObjectArgs().WithBucket(minIoSourceBucket)
.WithObject(minIoSourceFilePath)
.WithCallbackStream(async stream =>
{
var memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
await PutObjectAsync(amazonClient, amazonSinkBucket, amazonSinkFilePath,
memoryStream, memoryStream.Length, "application/octet-stream");
});
var getResult = await minIoClient.GetObjectAsync(getArgs);
Console.ReadKey();
}
public static async Task PutObjectAsync(MinioClient mediaClient, string bucketName, string objectName, Stream data, long size, string contentType = null,
Dictionary<string, string> metaData = null, CancellationToken cancellationToken = new CancellationToken())
{
var obj = new PutObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
.WithStreamData(data)
.WithObjectSize(size);
if (!string.IsNullOrWhiteSpace(contentType))
{
obj.WithContentType(contentType);
}
if (!(metaData is null))
{
obj.WithHeaders(metaData);
}
await mediaClient.PutObjectAsync(obj, cancellationToken);
}
}
}
I have diagnosed this to the CreateRequest method, the code does not load the region if it is a PUT request. This was added to prevent createBucket requests from failing however it means the region is not loaded for this put object request
I will raise a PR with my code fix for this
The text was updated successfully, but these errors were encountered:
anthonyMc11
pushed a commit
to anthonyMc11/minio-dotnet
that referenced
this issue
Nov 8, 2022
@anthonyMc11,
I noticed there might be another issue in GetRegion() method, but I will be addressing it in a separate issue, if it turns out to be legit.
Closing this one as fixed by PR #711
This issue follows on from my previous issue #673 , its the same code but a different path through to the issue
I am using the following code:
I have diagnosed this to the CreateRequest method, the code does not load the region if it is a PUT request. This was added to prevent createBucket requests from failing however it means the region is not loaded for this put object request
I will raise a PR with my code fix for this
The text was updated successfully, but these errors were encountered: