Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: repeated slice uploading on large file upload task #321

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion authentication/azure_identity_access_token_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
7 changes: 5 additions & 2 deletions fileuploader/large_file_upload_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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++
}
Expand Down