From cb329cc395946a619cda5501da88dcda15d84d9b Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Mon, 26 Aug 2024 16:51:22 +0300 Subject: [PATCH] fix: repeated slice uploading on large file upload task --- authentication/azure_identity_access_token_provider.go | 2 +- fileuploader/large_file_upload_task.go | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/authentication/azure_identity_access_token_provider.go b/authentication/azure_identity_access_token_provider.go index dc836ca..fd89a62 100644 --- a/authentication/azure_identity_access_token_provider.go +++ b/authentication/azure_identity_access_token_provider.go @@ -31,7 +31,7 @@ func NewAzureIdentityAccessTokenProviderWithScopesAndValidHostsAndObservabilityO if err != nil { return nil, err } - if len(scopes) == 0 { + if len(validHosts) == 0 { base.GetAllowedHostsValidator().SetAllowedHosts([]string{"graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"}) } result := &AzureIdentityAccessTokenProvider{ diff --git a/fileuploader/large_file_upload_task.go b/fileuploader/large_file_upload_task.go index 718ce41..c8283e7 100644 --- a/fileuploader/large_file_upload_task.go +++ b/fileuploader/large_file_upload_task.go @@ -3,13 +3,14 @@ package fileuploader import ( "context" "errors" - abstractions "github.com/microsoft/kiota-abstractions-go" - "github.com/microsoft/kiota-abstractions-go/serialization" "io" "os" "strconv" "strings" "time" + + abstractions "github.com/microsoft/kiota-abstractions-go" + "github.com/microsoft/kiota-abstractions-go/serialization" ) type LargeFileUploadTask[T serialization.Parsable] interface { @@ -140,6 +141,8 @@ func (l *largeFileUploadTask[T]) uploadWithRetry(slice uploadSlice[T], maxRetry } // backoff before retrying time.Sleep(time.Duration(retry) * time.Second) + } else { + return parseable, location, err // return the result as the upload was successful } retry++ }