From 63c553341ecc2f21f23776f543b94eabaa8209c3 Mon Sep 17 00:00:00 2001 From: Yifan Zhang Date: Wed, 10 Apr 2024 16:46:20 +0800 Subject: [PATCH 1/2] Update offset logic --- src/Storage/Storage.Management/ChangeLog.md | 2 ++ src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Storage/Storage.Management/ChangeLog.md b/src/Storage/Storage.Management/ChangeLog.md index 02e58dc4689d..2d982ce7cf2b 100644 --- a/src/Storage/Storage.Management/ChangeLog.md +++ b/src/Storage/Storage.Management/ChangeLog.md @@ -19,6 +19,8 @@ --> ## Upcoming Release * Fixed object replication policy time format parsing issue [#24434] +* Updatedd download offset and content length calculation logic for downloading files + - `Get-AzStorageFileContent` ## Version 6.1.3 * Introduced secrets detection feature to safeguard sensitive data. diff --git a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs index 1424ef53bf12..f6bb08110be8 100644 --- a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs +++ b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs @@ -340,8 +340,8 @@ await DataMovementTransferHelper.DoTransfer(() => downloadOptions.Range = new HttpRange(downloadOffset, contentSize); ShareFileDownloadInfo download = fileClientToBeDownloaded.Download(downloadOptions, cancellationToken: this.CmdletCancellationToken); download.Content.CopyTo(stream); - downloadOffset += contentSize; - contentLenLeft -= contentSize; + downloadOffset += download.ContentLength; + contentLenLeft -= download.ContentLength; progressHandler.Report(downloadOffset); } } From 2439269025a5b9c2b705a30f5d694b0d1701db31 Mon Sep 17 00:00:00 2001 From: NanxiangLiu <33285578+Nickcandy@users.noreply.github.com> Date: Fri, 19 Apr 2024 02:24:22 +0800 Subject: [PATCH 2/2] Update ChangeLog.md --- src/Storage/Storage.Management/ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storage/Storage.Management/ChangeLog.md b/src/Storage/Storage.Management/ChangeLog.md index 2d982ce7cf2b..5bfcd4936872 100644 --- a/src/Storage/Storage.Management/ChangeLog.md +++ b/src/Storage/Storage.Management/ChangeLog.md @@ -19,7 +19,7 @@ --> ## Upcoming Release * Fixed object replication policy time format parsing issue [#24434] -* Updatedd download offset and content length calculation logic for downloading files +* Updated download offset and content length calculation logic for downloading files - `Get-AzStorageFileContent` ## Version 6.1.3