Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] WithContentType has no effect if used after WithHeaders #1188

Open
yhnavein opened this issue Oct 4, 2024 · 0 comments
Open

[Bug] WithContentType has no effect if used after WithHeaders #1188

yhnavein opened this issue Oct 4, 2024 · 0 comments

Comments

@yhnavein
Copy link

yhnavein commented Oct 4, 2024

Let's consider the following code:

var metaData = new Dictionary<string, string>
    (StringComparer.Ordinal)
    {
        { "product-id", productId.ToString() }
    };
var putObjectArgs = new PutObjectArgs()
    .WithBucket("test-bucket")
    .WithObject(objectName)
    .WithObjectSize(inputStream.Length)
    .WithStreamData(inputStream)
    .WithHeaders(metaData)
    .WithContentType("image/png");

await _minioClient.PutObjectAsync(putObjectArgs, cancellationToken);

Code for me is absolutely correct, but the effect is that Content-Type of the upload file will always be application/octet-stream, where it's strictly specified to be image/png. This is as such a bug.

But apparently If I change order and make WithContentType go BEFORE WithHeaders then it will work correctly and Content-Type will be assigned as it should.
So it looks like specifying WithContentType after WithHeaders has no effect and the default value will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant