Skip to content

Commit

Permalink
Feature/storage/blob access policy bug (#14872)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcc-msft authored Sep 4, 2020
1 parent 9e8cb6b commit ec6fb5c
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 12 deletions.
1 change: 1 addition & 0 deletions sdk/storage/Azure.Storage.Blobs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 12.7.0-preview.1 (Unreleased)
- Fixed bug where Stream returned from AppendBlobClient.OpenWrite(), BlockBlobClient.OpenWrite() and PageBlobClient.OpenWrite() did not flush while disposing preventing compatibility with using keyword.
- Fixed bug where Listing Blobs with BlobTraits.Metadata would return BlobItems with null metadata instead of an empty dictionary if no metadata was present.
- Fixed bug where BlobAccessPolicy.StartsOn and .ExpiresOn would cause the process to crash.

## 12.6.0 (2020-08-31)
- Fixed bug where BlobClient.Upload(), BlockBlobClient.Upload(), AppendBlobClient.AppendBlock(), and PageBlobClient.UploadPages() would deadlock if the content stream's position was not 0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public System.DateTimeOffset StartsOn
get
{
return PolicyStartsOn == default ?
StartsOn :
(DateTimeOffset)PolicyStartsOn;
new DateTimeOffset() :
PolicyStartsOn.Value;
}
set
{
Expand All @@ -42,8 +42,8 @@ public System.DateTimeOffset ExpiresOn
get
{
return PolicyExpiresOn == default ?
ExpiresOn :
(DateTimeOffset)PolicyExpiresOn;
new DateTimeOffset() :
PolicyExpiresOn.Value;
}
set
{
Expand Down
12 changes: 12 additions & 0 deletions sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,18 @@ await test.Container.SetAccessPolicyAsync(
Assert.AreEqual(signedIdentifiers[0].AccessPolicy.Permissions, acl.AccessPolicy.Permissions);
}

[Test]
public void BlobAccessPolicyNullStartsOnExpiresOnTest()
{
BlobAccessPolicy accessPolicy = new BlobAccessPolicy()
{
Permissions = "rw"
};

Assert.AreEqual(new DateTimeOffset(), accessPolicy.StartsOn);
Assert.AreEqual(new DateTimeOffset(), accessPolicy.ExpiresOn);
}

[Test]
public async Task SetAccessPolicyAsync_OldProperties()
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/storage/Azure.Storage.Files.DataLake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 12.5.0-preview.1 (Unreleased)
- Fixed bug where Stream returned from DataLakeFileClient.OpenWrite() did not flush while disposing preventing compatibility with using keyword.
- Fixed bug where DataLakeFileClient.Upload() could not upload read-only files.
- Fixed bug where DataLakeBlobAccessPolicy.StartsOn and .ExpiresOn would cause the process to crash.

## 12.4.0 (2020-08-31)
- Fixed bug where DataLakeFileClient.Upload() would deadlock if the content stream's position was not 0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public System.DateTimeOffset StartsOn
get
{
return PolicyStartsOn == default ?
StartsOn :
(DateTimeOffset)PolicyStartsOn;
new DateTimeOffset() :
PolicyStartsOn.Value;
}
set
{
Expand All @@ -51,8 +51,8 @@ public System.DateTimeOffset ExpiresOn
get
{
return PolicyExpiresOn == default ?
ExpiresOn :
(DateTimeOffset)PolicyExpiresOn;
new DateTimeOffset() :
PolicyExpiresOn.Value;
}
set
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1807,6 +1807,18 @@ await TestHelper.AssertExpectedExceptionAsync<RequestFailedException>(
}
}

[Test]
public void DataLakeAccessPolicyNullStartsOnExpiresOnTest()
{
DataLakeAccessPolicy accessPolicy = new DataLakeAccessPolicy()
{
Permissions = "rw"
};

Assert.AreEqual(new DateTimeOffset(), accessPolicy.StartsOn);
Assert.AreEqual(new DateTimeOffset(), accessPolicy.ExpiresOn);
}

[Test]
[TestCase("!'();[]@&%=+$,#äÄöÖüÜß;")]
[TestCase("%21%27%28%29%3B%5B%5D%40%26%25%3D%2B%24%2C%23äÄöÖüÜß%3B")]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/storage/Azure.Storage.Files.Shares/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 12.5.0-preview.1 (Unreleased)
- Fixed bug where Stream returned from ShareFileClient.OpenWrite() did not flush while disposing preventing compatibility with using keyword.
- Fixed bug where ShareAccessPolicy.StartsOn and .ExpiresOn would cause the process to crash.

## 12.4.0 (2020-08-31)
- Fixed bug where ShareFileClient.Upload() and .UploadRange() would deadlock if the content stream's position was not zero.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public System.DateTimeOffset StartsOn
get
{
return PolicyStartsOn == default ?
StartsOn :
(DateTimeOffset)PolicyStartsOn;
new DateTimeOffset() :
PolicyStartsOn.Value;
}
set
{
Expand All @@ -42,8 +42,8 @@ public System.DateTimeOffset ExpiresOn
get
{
return PolicyExpiresOn == default ?
ExpiresOn :
(DateTimeOffset)PolicyExpiresOn;
new DateTimeOffset() :
PolicyExpiresOn.Value;
}
set
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,18 @@ await TestHelper.AssertExpectedExceptionAsync<RequestFailedException>(
e => Assert.AreEqual("ShareNotFound", e.ErrorCode));
}

[Test]
public void ShareAccessPolicyNullStartsOnExpiresOnTest()
{
ShareAccessPolicy accessPolicy = new ShareAccessPolicy()
{
Permissions = "rw"
};

Assert.AreEqual(new DateTimeOffset(), accessPolicy.StartsOn);
Assert.AreEqual(new DateTimeOffset(), accessPolicy.ExpiresOn);
}

[Test]
public async Task GetStatisticsAsync()
{
Expand Down

0 comments on commit ec6fb5c

Please sign in to comment.