Skip to content

Commit

Permalink
Fixed bug where BlobBaseClient.DownloadStreamingAsync() won't correct…
Browse files Browse the repository at this point in the history
…ly parse the LeaseStatus header. (#22306)
  • Loading branch information
seanmcc-msft authored Jun 30, 2021
1 parent 73b2777 commit 6e7a370
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 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 @@ -12,6 +12,7 @@
- Added optimization to unwrap encryption key once for DownloadTo and OpenRead when Client Side Encryption is enabled.
- Added support for RequestConditions parameter validation. If a request condition is set for an API that doesn't support it, and ArguementException will be thrown.
- This feature can be disabled with the environment variable "AZURE_STORAGE_DISABLE_REQUEST_CONDITIONS_VALIDATION" or the App Context switch "Azure.Storage.DisableRequestConditionsValidation".
- Fixed bug where BlobBaseClient.DownloadStreamingAsync() won't correctly parse the LeaseStatus header.

## 12.9.1 (2021-06-23)
- Added optimization to unwrap encryption key once for DownloadTo and OpenRead when Client Side Encryption is enabled.
Expand Down
1 change: 1 addition & 0 deletions sdk/storage/Azure.Storage.Blobs/src/BlobExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ internal static BlobDownloadStreamingResult ToBlobDownloadStreamingResult(this R
CopySource = response.Headers.CopySource == null ? null : new Uri(response.Headers.CopySource),
CopyStatus = response.Headers.CopyStatus.GetValueOrDefault(),
LeaseDuration = response.Headers.LeaseDuration ?? LeaseDurationType.Infinite,
LeaseStatus = response.Headers.LeaseStatus ?? LeaseStatus.Unlocked,
LeaseState = response.Headers.LeaseState.GetValueOrDefault(),
AcceptRanges = response.Headers.AcceptRanges,
BlobCommittedBlockCount = response.Headers.BlobCommittedBlockCount.GetValueOrDefault(),
Expand Down
4 changes: 4 additions & 0 deletions sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ public async Task DownloadAsync_Streaming()
var actual = new MemoryStream();
await response.Value.Content.CopyToAsync(actual);
TestHelper.AssertSequenceEqual(data, actual.ToArray());

Assert.AreEqual(LeaseStatus.Unlocked, response.Value.Details.LeaseStatus);
Assert.AreEqual(LeaseState.Available, response.Value.Details.LeaseState);
Assert.AreEqual(LeaseDurationType.Infinite, response.Value.Details.LeaseDuration);
}

[RecordedTest]
Expand Down

0 comments on commit 6e7a370

Please sign in to comment.