From b09722e1991c6b8470840b00c0974a923542dff1 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 25 Oct 2023 09:38:14 -0700 Subject: [PATCH] Patch for destination length check with no read permissions --- ChangeLog.md | 6 ++++++ common/version.go | 2 +- ste/xfer-anyToRemote-file.go | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 908f8afec..ce15e16fa 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,12 @@ # Change Log +## Version 10.21.1 + +### Bug Fixes + +1. Fixed an issue where validating destination length would fail a job instead of logging the error if read permissions are not provided. + ## Version 10.21.0 ### New Features diff --git a/common/version.go b/common/version.go index bdd7c3c2f..193a29088 100644 --- a/common/version.go +++ b/common/version.go @@ -1,6 +1,6 @@ package common -const AzcopyVersion = "10.21.0" +const AzcopyVersion = "10.21.1" const UserAgent = "AzCopy/" + AzcopyVersion const S3ImportUserAgent = "S3Import " + UserAgent const GCPImportUserAgent = "GCPImport " + UserAgent diff --git a/ste/xfer-anyToRemote-file.go b/ste/xfer-anyToRemote-file.go index 63773126d..f9894162b 100644 --- a/ste/xfer-anyToRemote-file.go +++ b/ste/xfer-anyToRemote-file.go @@ -25,6 +25,7 @@ import ( "crypto/md5" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob" "hash" "net/http" @@ -552,8 +553,9 @@ func epilogueWithCleanupSendToRemote(jptm IJobPartTransferMgr, s sender, sip ISo shouldCheckLength := true destLength, err := s.GetDestinationLength() - if resp, respOk := err.(pipeline.Response); respOk && resp.Response() != nil && - resp.Response().StatusCode == http.StatusForbidden { + var respErr *azcore.ResponseError + resp, respOk := err.(pipeline.Response) + if (respOk && resp.Response() != nil && resp.Response().StatusCode == http.StatusForbidden) || (errors.As(err, &respErr) && respErr.StatusCode == http.StatusForbidden) { // The destination is write-only. Cannot verify length shouldCheckLength = false checkLengthFailureOnReadOnlyDst.Do(func() {