Aws-sdk-net: AmazonS3Client.PutBucketTagging puts tags key as a bucket tag value

Created on 14 Oct 2018  路  4Comments  路  Source: aws/aws-sdk-net

AmazonS3Client.PutBucketTagging puts tags key as a tag value.

Expected Behavior

AmazonS3Client.PutBucketTagging puts passed tag value as a value

Current Behavior

AWSSDK.S3 starting from version 3.3.24 creates buckets tags with wrong value. It puts passed Key as a Value.

Possible Solution

It seems that there is a bug in the https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Services/S3/Custom/Model/Tag.cs line 69
there are should be:
xmlWriter.WriteElementString("Value", S3Transforms.ToXmlStringValue(value));

Steps to Reproduce (for bugs)

        var s3 = new AmazonS3Client(RegionEndpoint.EUWest1);
        var res1 = await s3.PutBucketAsync(bucketName);
        var res2 = await s3.PutBucketTaggingAsync(new PutBucketTaggingRequest
        {
            BucketName = bucketName,
            TagSet = new List<Tag>
            {
                new Tag { Key = "my-key", Value = "my-value"}
            }
        });
        var res3 = await s3.GetBucketTaggingAsync(new GetBucketTaggingRequest {BucketName = bucketName});
        var tag = res3.TagSet.FirstOrDefault();
        if (tag.Key != "my-key" || tag.Value != $"my-value")
            Console.WriteLine("Wrong tags");

Context

Create bucket and put some tag

Your Environment

  • AWSSDK.Core version used: 3.3.25.4
  • Service assembly and version used: AWSSDK.S3 3.3.24.1
  • Operating System and version: Ubuntu 16.04
  • Visual Studio version: Rider 2018.2.3
  • Targeted .NET platform: .NETCoreApp 2.1

.NET Core Info

  • .NET Core version used for development:
  • .NET Core version installed in the environment where application runs:
  • Output of dotnet --info:

.NET Core SDK (reflecting any global.json):
Version: 2.1.403
Commit: 04e15494b6

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.1.403/

Host (useful for support):
Version: 2.1.5
Commit: 290303f510

.NET Core SDKs installed:
2.1.403 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

  • Contents of project.json/project.csproj:


    Exe
    netcoreapp2.1
    7.1



bug

All 4 comments

Agreed, we'll get that fixed up.

This was fixed and released as of AWSSDK.S3 3.3.25.1

Hi,

I used latest version AWSSDK.S3 3.3.31.17 and the same issue happened: AmazonS3Client.PutBucketTagging puts tags key as a tag value.

I then tried version AWSSDK.S3 3.3.25.1 and still the issue remains. Can someone please verify that this issue is indeed fixed? Thanks!

Sorry, ignore my last post. This issue is fixed. Thanks!

Was this page helpful?
0 / 5 - 0 ratings