Skip to content

Commit

Permalink
Bugfix ecsoe 8877 metadata sort (#3)
Browse files Browse the repository at this point in the history
The comparer param was set such that keys would be upper-cased before sorting.  Switched to InvariantCultureIgnoreCase to fix.
  • Loading branch information
ben-schumacher authored Apr 12, 2019
1 parent e309db4 commit ba62f95
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
25 changes: 25 additions & 0 deletions ecs-object-client-dotnet-test/ECSSDK.Test.ObjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,5 +420,30 @@ public void TestStandardAwsStuff()
});

}

[TestMethod]
public void TestObjectWithMetadata()
{
string key = "meta-1";
string content = "sample object data content ...";

PutObjectRequest por = new PutObjectRequest()
{
BucketName = temp_bucket,
Key = key,
ContentBody = content,
};

por.Metadata.Add("555", "55555");
por.Metadata.Add("bbb", "bbbbb");
por.Metadata.Add("b_b_b", "bubub");
por.Metadata.Add("aaa", "aaaaa");
por.Metadata.Add("a_a_a", "auaua");
por.Metadata.Add("111", "11111");

PutObjectResponse response = client.PutObject(por);
Assert.AreEqual(response.HttpStatusCode, System.Net.HttpStatusCode.OK);

}
}
}
2 changes: 1 addition & 1 deletion ecs-object-client-dotnet/Internal/S3SignerECS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static string BuildStringToSign(IRequest request)
static string BuildCanonicalizedHeaders(IDictionary<string, string> headers)
{
var sb = new StringBuilder(256);
foreach (var key in headers.Keys.OrderBy(x => x, StringComparer.OrdinalIgnoreCase))
foreach (var key in headers.Keys.OrderBy(x => x, StringComparer.InvariantCultureIgnoreCase))
{
var lowerKey = key.ToLowerInvariant();
if (!lowerKey.StartsWith("x-amz-", StringComparison.Ordinal) &&
Expand Down
4 changes: 2 additions & 2 deletions ecs-object-client-dotnet/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]

0 comments on commit ba62f95

Please sign in to comment.