From e7d15f49bfc14295c0169568d1ede0ed6c06488d Mon Sep 17 00:00:00 2001 From: Wei Wei Date: Wed, 7 Apr 2021 17:03:30 +0800 Subject: [PATCH] [Storage] Fix delete immutable blob will give incorrect prompt (#14691) --- src/Storage/Storage.Management/ChangeLog.md | 2 ++ src/Storage/Storage/Blob/Cmdlet/RemoveAzureStorageBlob.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Storage/Storage.Management/ChangeLog.md b/src/Storage/Storage.Management/ChangeLog.md index f8c7ad3bbc46..b665b407c1ba 100644 --- a/src/Storage/Storage.Management/ChangeLog.md +++ b/src/Storage/Storage.Management/ChangeLog.md @@ -18,6 +18,8 @@ - Additional information about change #1 --> ## Upcoming Release +* Fixed an issue that delete immutable blob will prompt incorrect message. + - `Remove-AzStorageAccount` * Fixed copy blob fail with source context as Oauth [#14662] - `Start-AzStorageBlobCopy` diff --git a/src/Storage/Storage/Blob/Cmdlet/RemoveAzureStorageBlob.cs b/src/Storage/Storage/Blob/Cmdlet/RemoveAzureStorageBlob.cs index de07fa5cb0d8..6015b33f3811 100644 --- a/src/Storage/Storage/Blob/Cmdlet/RemoveAzureStorageBlob.cs +++ b/src/Storage/Storage/Blob/Cmdlet/RemoveAzureStorageBlob.cs @@ -181,7 +181,7 @@ internal async Task RemoveAzureBlob(long taskId, IStorageBlobManagement localCha } catch (StorageException e) { - if (e.IsConflictException() && retryDeleteSnapshot) + if (e.IsConflictException() && e.RequestInformation.ErrorCode.Equals("SnapshotsPresent", StringComparison.InvariantCultureIgnoreCase) && retryDeleteSnapshot) { //If x-ms-delete-snapshots is not specified on the request and the blob has associated snapshots, the Blob service returns status code 409 (Conflict). retryDeleteSnapshot = true;