Skip to content

Commit 9fcfb76

Browse files
authored
Revert "[Storage] [BUG] Fixed ContentRange is null in BlobDownloadDetails whe…" (#48341)
This reverts commit b38a9c2.
1 parent a4d1f03 commit 9fcfb76

File tree

8 files changed

+19
-177
lines changed

8 files changed

+19
-177
lines changed

sdk/storage/Azure.Storage.Blobs/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
### Breaking Changes
88

99
### Bugs Fixed
10-
- Fixed ContentRange is null in BlobDownloadDetails when calling DownloadStreamingAsync with HttpRange "0-" #47882
1110

1211
### Other Changes
1312

sdk/storage/Azure.Storage.Blobs/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/storage/Azure.Storage.Blobs",
5-
"Tag": "net/storage/Azure.Storage.Blobs_11b2adbc87"
5+
"Tag": "net/storage/Azure.Storage.Blobs_f174db6035"
66
}

sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,6 @@ private async Task<Response<BlobDownloadInfo>> DownloadInternal(
10071007
{
10081008
Response<BlobDownloadStreamingResult> response = await DownloadStreamingDirect(
10091009
range,
1010-
range != default,
10111010
conditions,
10121011
rangeGetContentHash.ToValidationOptions(),
10131012
progressHandler: default,
@@ -1241,7 +1240,6 @@ public virtual Response<BlobDownloadStreamingResult> DownloadStreaming(
12411240
{
12421241
return DownloadStreamingDirect(
12431242
range,
1244-
true,
12451243
conditions,
12461244
rangeGetContentHash.ToValidationOptions(),
12471245
progressHandler,
@@ -1318,7 +1316,6 @@ public virtual async Task<Response<BlobDownloadStreamingResult>> DownloadStreami
13181316
{
13191317
return await DownloadStreamingDirect(
13201318
range,
1321-
true,
13221319
conditions,
13231320
rangeGetContentHash.ToValidationOptions(),
13241321
progressHandler,
@@ -1372,7 +1369,6 @@ public virtual Response<BlobDownloadStreamingResult> DownloadStreaming(
13721369
{
13731370
return DownloadStreamingDirect(
13741371
options?.Range ?? default,
1375-
options?._isRangeSet ?? false,
13761372
options?.Conditions,
13771373
options?.TransferValidation,
13781374
options?.ProgressHandler,
@@ -1420,7 +1416,6 @@ public virtual async Task<Response<BlobDownloadStreamingResult>> DownloadStreami
14201416
{
14211417
return await DownloadStreamingDirect(
14221418
options?.Range ?? default,
1423-
options?._isRangeSet ?? false,
14241419
options?.Conditions,
14251420
options?.TransferValidation,
14261421
options?.ProgressHandler,
@@ -1435,7 +1430,6 @@ public virtual async Task<Response<BlobDownloadStreamingResult>> DownloadStreami
14351430
/// Implementation for public DownloadStreaming/DownloadContent methods to call into.
14361431
/// </summary>
14371432
/// <param name="range"></param>
1438-
/// <param name="isRangeSet"></param>
14391433
/// <param name="conditions"></param>
14401434
/// <param name="transferValidationOverride"></param>
14411435
/// <param name="progressHandler"></param>
@@ -1445,7 +1439,6 @@ public virtual async Task<Response<BlobDownloadStreamingResult>> DownloadStreami
14451439
/// <returns></returns>
14461440
private async ValueTask<Response<BlobDownloadStreamingResult>> DownloadStreamingDirect(
14471441
HttpRange range,
1448-
bool isRangeSet,
14491442
BlobRequestConditions conditions,
14501443
DownloadTransferValidationOptions transferValidationOverride,
14511444
IProgress<long> progressHandler,
@@ -1462,7 +1455,7 @@ private async ValueTask<Response<BlobDownloadStreamingResult>> DownloadStreaming
14621455
}
14631456
}
14641457

1465-
var response = await DownloadStreamingInternal(range, isRangeSet, conditions, transferValidationOverride, progressHandler, operationName, async, cancellationToken).ConfigureAwait(false);
1458+
var response = await DownloadStreamingInternal(range, conditions, transferValidationOverride, progressHandler, operationName, async, cancellationToken).ConfigureAwait(false);
14661459

14671460
// if using clientside encryption, wrap the auto-retry stream in a decryptor
14681461
// we already return a nonseekable stream; returning a crypto stream is fine
@@ -1488,9 +1481,6 @@ private async ValueTask<Response<BlobDownloadStreamingResult>> DownloadStreaming
14881481
/// <param name="range">
14891482
/// Optionally specified range.
14901483
/// </param>
1491-
/// <param name="isRangeSet">
1492-
/// If range has been set
1493-
/// </param>
14941484
/// <param name="conditions">
14951485
/// Access conditions.
14961486
/// </param>
@@ -1512,7 +1502,6 @@ private async ValueTask<Response<BlobDownloadStreamingResult>> DownloadStreaming
15121502
/// <returns></returns>
15131503
internal virtual async ValueTask<Response<BlobDownloadStreamingResult>> DownloadStreamingInternal(
15141504
HttpRange range,
1515-
bool isRangeSet,
15161505
BlobRequestConditions conditions,
15171506
DownloadTransferValidationOptions transferValidationOverride,
15181507
IProgress<long> progressHandler,
@@ -1540,7 +1529,6 @@ internal virtual async ValueTask<Response<BlobDownloadStreamingResult>> Download
15401529
// Start downloading the blob
15411530
Response<BlobDownloadStreamingResult> response = await StartDownloadAsync(
15421531
range,
1543-
isRangeSet,
15441532
conditions,
15451533
validationOptions,
15461534
async: async,
@@ -1564,7 +1552,6 @@ internal virtual async ValueTask<Response<BlobDownloadStreamingResult>> Download
15641552
startOffset =>
15651553
StartDownloadAsync(
15661554
range,
1567-
isRangeSet,
15681555
conditionsWithEtag,
15691556
validationOptions,
15701557
startOffset,
@@ -1575,7 +1562,6 @@ internal virtual async ValueTask<Response<BlobDownloadStreamingResult>> Download
15751562
async startOffset =>
15761563
(await StartDownloadAsync(
15771564
range,
1578-
isRangeSet,
15791565
conditionsWithEtag,
15801566
validationOptions,
15811567
startOffset,
@@ -1643,9 +1629,6 @@ await ContentHasher.AssertResponseHashMatchInternal(
16431629
/// If provided, only download the bytes of the blob in the specified
16441630
/// range. If not provided, download the entire blob.
16451631
/// </param>
1646-
/// <param name="isRangeSet">
1647-
/// Whether range has been set.
1648-
/// </param>
16491632
/// <param name="conditions">
16501633
/// Optional <see cref="BlobRequestConditions"/> to add conditions on
16511634
/// downloading this blob.
@@ -1676,15 +1659,14 @@ await ContentHasher.AssertResponseHashMatchInternal(
16761659
/// </remarks>
16771660
private async ValueTask<Response<BlobDownloadStreamingResult>> StartDownloadAsync(
16781661
HttpRange range,
1679-
bool isRangeSet,
16801662
BlobRequestConditions conditions,
16811663
DownloadTransferValidationOptions validationOptions,
16821664
long startOffset = 0,
16831665
bool async = true,
16841666
CancellationToken cancellationToken = default)
16851667
{
16861668
HttpRange? pageRange = null;
1687-
if (isRangeSet) // we want to check if the range has been manually set
1669+
if (range != default(HttpRange)) // we want to check between non-nullable ranges
16881670
{
16891671
pageRange = new HttpRange(
16901672
range.Offset + startOffset,
@@ -1961,7 +1943,6 @@ public virtual Response<BlobDownloadResult> DownloadContent(
19611943
conditions,
19621944
progressHandler: default,
19631945
range: default,
1964-
isRangeSet: false,
19651946
transferValidationOverride: default,
19661947
false, // async
19671948
cancellationToken)
@@ -2018,7 +1999,6 @@ await DownloadContentInternal(
20181999
conditions,
20192000
progressHandler: default,
20202001
range: default,
2021-
isRangeSet: false,
20222002
transferValidationOverride: default,
20232003
true, // async
20242004
cancellationToken)
@@ -2084,7 +2064,6 @@ public virtual Response<BlobDownloadResult> DownloadContent(
20842064
conditions,
20852065
progressHandler,
20862066
range,
2087-
true,
20882067
transferValidationOverride: default,
20892068
false, // async
20902069
cancellationToken)
@@ -2150,7 +2129,6 @@ await DownloadContentInternal(
21502129
conditions,
21512130
progressHandler,
21522131
range,
2153-
true,
21542132
transferValidationOverride: default,
21552133
true, // async
21562134
cancellationToken)
@@ -2203,7 +2181,6 @@ public virtual Response<BlobDownloadResult> DownloadContent(
22032181
options?.Conditions,
22042182
options?.ProgressHandler,
22052183
options?.Range ?? default,
2206-
options?._isRangeSet ?? false,
22072184
options?.TransferValidation,
22082185
async: false,
22092186
cancellationToken).EnsureCompleted();
@@ -2255,7 +2232,6 @@ await DownloadContentInternal(
22552232
options?.Conditions,
22562233
options?.ProgressHandler,
22572234
options?.Range ?? default,
2258-
options?._isRangeSet ?? false,
22592235
options?.TransferValidation,
22602236
async: true,
22612237
cancellationToken).ConfigureAwait(false);
@@ -2264,14 +2240,12 @@ private async Task<Response<BlobDownloadResult>> DownloadContentInternal(
22642240
BlobRequestConditions conditions,
22652241
IProgress<long> progressHandler,
22662242
HttpRange range,
2267-
bool isRangeSet,
22682243
DownloadTransferValidationOptions transferValidationOverride,
22692244
bool async,
22702245
CancellationToken cancellationToken)
22712246
{
22722247
Response<BlobDownloadStreamingResult> response = await DownloadStreamingDirect(
22732248
range,
2274-
isRangeSet,
22752249
conditions,
22762250
transferValidationOverride: transferValidationOverride,
22772251
progressHandler,
@@ -3212,7 +3186,6 @@ internal async Task<Stream> OpenReadInternal(
32123186
}
32133187
Response<BlobDownloadStreamingResult> response = await DownloadStreamingInternal(
32143188
range,
3215-
true,
32163189
readConditions,
32173190
transferValidationOverride: downloadValidationOptions,
32183191
progressHandler: default,

sdk/storage/Azure.Storage.Blobs/src/Models/BlobDownloadOptions.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,11 @@ namespace Azure.Storage.Blobs.Models
1111
/// </summary>
1212
public class BlobDownloadOptions
1313
{
14-
private HttpRange _range;
15-
internal bool _isRangeSet;
16-
1714
/// <summary>
1815
/// If provided, only download the bytes of the blob in the specified
1916
/// range. If not provided, download the entire blob.
2017
/// </summary>
21-
public HttpRange Range
22-
{
23-
get => _range;
24-
set
25-
{
26-
_range = value;
27-
_isRangeSet = true;
28-
}
29-
}
18+
public HttpRange Range { get; set; }
3019

3120
/// <summary>
3221
/// Optional <see cref="BlobRequestConditions"/> to add conditions on

sdk/storage/Azure.Storage.Blobs/src/PartitionedDownloader.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public async Task<Response> DownloadToInternal(
161161
{
162162
initialResponse = await _client.DownloadStreamingInternal(
163163
initialRange,
164-
true,
165164
conditions,
166165
ValidationOptions,
167166
_progress,
@@ -173,7 +172,6 @@ public async Task<Response> DownloadToInternal(
173172
{
174173
initialResponse = await _client.DownloadStreamingInternal(
175174
range: default,
176-
false,
177175
conditions,
178176
ValidationOptions,
179177
_progress,
@@ -232,8 +230,8 @@ await HandleOneShotDownload(initialResponse, destination, async, cancellationTok
232230
BlobRequestConditions conditionsWithEtag = conditions?.WithIfMatch(etag) ?? new BlobRequestConditions { IfMatch = etag };
233231

234232
#pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope.
235-
// Rule checker cannot understand this section, but this
236-
// massively reduces code duplication.
233+
// Rule checker cannot understand this section, but this
234+
// massively reduces code duplication.
237235
int effectiveWorkerCount = async ? _maxWorkerCount : 1;
238236
if (effectiveWorkerCount > 1)
239237
{
@@ -262,7 +260,6 @@ await HandleOneShotDownload(initialResponse, destination, async, cancellationTok
262260
ValueTask<Response<BlobDownloadStreamingResult>> responseValueTask = _client
263261
.DownloadStreamingInternal(
264262
httpRange,
265-
true,
266263
conditionsWithEtag,
267264
ValidationOptions,
268265
_progress,
@@ -341,13 +338,13 @@ await CopyToInternal(
341338
async,
342339
cancellationToken)
343340
.ConfigureAwait(false);
344-
if (UseMasterCrc)
345-
{
346-
StorageCrc64Composer.Compose(
347-
(composedCrc.ToArray(), 0L),
348-
(partitionChecksum.ToArray(), response.Value.Details.ContentLength)
349-
).CopyTo(composedCrc);
350-
}
341+
if (UseMasterCrc)
342+
{
343+
StorageCrc64Composer.Compose(
344+
(composedCrc.ToArray(), 0L),
345+
(partitionChecksum.ToArray(), response.Value.Details.ContentLength)
346+
).CopyTo(composedCrc);
347+
}
351348
}
352349
}
353350
}

0 commit comments

Comments
 (0)