diff --git a/e2etest/zt_basic_copy_sync_remove_test.go b/e2etest/zt_basic_copy_sync_remove_test.go index eb5bdd176..1b312380a 100644 --- a/e2etest/zt_basic_copy_sync_remove_test.go +++ b/e2etest/zt_basic_copy_sync_remove_test.go @@ -89,6 +89,24 @@ func TestBasic_CopyDownloadSingleBlob(t *testing.T) { }, EAccountType.Standard(), EAccountType.Standard(), "") } +func TestBasic_CopyDownloadSingleBlobEmptyDir(t *testing.T) { + // Only Windows fails to rename if there is an empty dir name in the path + if runtime.GOOS != "windows" { + return + } + RunScenarios(t, eOperation.Copy(), eTestFromTo.Other(common.EFromTo.BlobLocal()), eValidate.Auto(), allCredentialTypes, anonymousAuthOnly, params{ + recursive: true, + }, nil, testFiles{ + defaultSize: "1K", + shouldTransfer: []interface{}{ + folder(""), + }, + shouldFail: []interface{}{ + f("dir1//dir3/file1.txt"), + }, + }, EAccountType.Standard(), EAccountType.Standard(), "") +} + func TestBasic_CopyDownloadEmptyBlob(t *testing.T) { RunScenarios(t, eOperation.CopyAndSync(), eTestFromTo.AllDownloads(), eValidate.Auto(), anonymousAuthOnly, anonymousAuthOnly, params{ recursive: true, diff --git a/ste/xfer-remoteToLocal-file.go b/ste/xfer-remoteToLocal-file.go index f124b60ee..dfb791945 100644 --- a/ste/xfer-remoteToLocal-file.go +++ b/ste/xfer-remoteToLocal-file.go @@ -421,15 +421,13 @@ func epilogueWithCleanupDownload(jptm IJobPartTransferMgr, dl downloader, active } // check if we need to rename back to original name. At this point, we're sure the file is completely - // downloaded and not corrupt. In fact, post this point we should only log errors and - // not fail the transfer. + // downloaded and not corrupt. renameNecessary := !strings.EqualFold(info.getDownloadPath(), info.Destination) && !strings.EqualFold(info.Destination, common.Dev_Null) if err == nil && renameNecessary { renameErr := os.Rename(info.getDownloadPath(), info.Destination) if renameErr != nil { - jptm.LogError(info.Destination, fmt.Sprintf( - "Failed to rename. File at %s", info.getDownloadPath()), renameErr) + jptm.FailActiveDownload("Download rename", renameErr) } } }