Skip to content

Commit f78468a

Browse files
authored
[Storage] Added a breaking warning : download blob will block input parameter -AbsoluteUri and -Context together (#26377)
* [Storage] Added a warning for an upcoming breaking change for download blob with parameter -AbsoluteUri will not allow parameter -Context be input together. * add 1 more change log * fix warning not show problem
1 parent 885318e commit f78468a

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

src/Storage/Storage.Management/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Added a warning for an upcoming breaking change for download blob will block input parameter -AbsoluteUri and -Context together.
22+
- `Get-AzStorageBlobContent`
23+
* Revised AzureStorageBlob construct logic to make it more stable.
2124

2225
## Version 7.4.0
2326
* Added a warning for an upcoming breaking change for removing references to "Microsoft.Azure.Storage.File"

src/Storage/Storage/Blob/Cmdlet/GetAzureStorageBlobContent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using Track2Models = global::Azure.Storage.Blobs.Models;
3131
using Azure.Storage.Blobs;
3232
using Azure.Storage;
33+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
3334

3435
namespace Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet
3536
{
@@ -112,6 +113,7 @@ public SwitchParameter CheckMd5
112113

113114
private bool checkMd5;
114115

116+
[CmdletParameterBreakingChangeWithVersion("AbsoluteUri", "13.0.0", "8.0.0", ChangeDescription = "When download blob with parameter AbsoluteUri (alias Uri, BlobUri), parameter Context will not be allowed to input together.")]
115117
[Alias("Uri", "BlobUri")]
116118
[Parameter(HelpMessage = "Blob uri to download from.", Mandatory = true,
117119
ValueFromPipelineByPropertyName = true, ParameterSetName = UriParameterSet)]

src/Storage/Storage/Blob/StorageDataMovementCmdletBase.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,7 @@ protected override void BeginProcessing()
112112

113113
protected virtual void DoBeginProcessing()
114114
{
115-
CmdletOperationContext.Init();
116-
CmdletCancellationToken = _cancellationTokenSource.Token;
117-
WriteDebugLog(String.Format(Resources.InitOperationContextLog, GetType().Name, CmdletOperationContext.ClientRequestId));
118-
119-
if (_enableMultiThread)
120-
{
121-
SetUpMultiThreadEnvironment();
122-
}
123-
124-
OpContext.GlobalSendingRequest +=
125-
(sender, args) =>
126-
{
127-
//https://github.com/Azure/azure-storage-net/issues/658
128-
};
115+
base.BeginProcessing();
129116

130117
OutputStream.ConfirmWriter = (s1, s2, s3) => ShouldContinue(s2, s3);
131118

src/Storage/Storage/Common/AzureStorageBlob.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ public static CloudBlob GetTrack1Blob(BlobBaseClient track2BlobClient, StorageCr
414414
return new InvalidCloudBlob(track2BlobClient.Uri, credentials);
415415
}
416416

417-
if (credentials.IsSAS) // the Uri already contains credentail.
417+
if (credentials != null && credentials.IsSAS) // the Uri already contains credentail.
418418
{
419419
credentials = null;
420420
}
@@ -497,12 +497,12 @@ public static BlobClient GetTrack2BlobClient(BlobBaseClient blobBaseClient, Azur
497497
return (BlobClient)blobBaseClient;
498498
}
499499
BlobClient blobClient;
500-
if (context.StorageAccount != null && context.StorageAccount.Credentials != null && context.StorageAccount.Credentials.IsToken) //Oauth
500+
if (context != null && context.StorageAccount != null && context.StorageAccount.Credentials != null && context.StorageAccount.Credentials.IsToken) //Oauth
501501
{
502502
blobClient = new BlobClient(blobBaseClient.Uri, context.Track2OauthToken, options);
503503

504504
}
505-
else if (context.StorageAccount != null && context.StorageAccount.Credentials != null && context.StorageAccount.Credentials.IsSharedKey) //Shared Key
505+
else if (context != null && context.StorageAccount != null && context.StorageAccount.Credentials != null && context.StorageAccount.Credentials.IsSharedKey) //Shared Key
506506
{
507507
blobClient = new BlobClient(blobBaseClient.Uri,
508508
new StorageSharedKeyCredential(context.StorageAccountName, context.StorageAccount.Credentials.ExportBase64EncodedKey()), options);

0 commit comments

Comments
 (0)