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

Feature/storage/blob access policy bug #14872

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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