From 7c8e9054ced3403092c5249e3d5695f436387726 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Tue, 26 Apr 2022 19:08:30 +0800 Subject: [PATCH] fix: OneDrive chunk upload time should be `0`, avoiding upload timeouts when chunk size is large --- pkg/filesystem/driver/onedrive/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/filesystem/driver/onedrive/api.go b/pkg/filesystem/driver/onedrive/api.go index 5dc2ec9..7ff5711 100644 --- a/pkg/filesystem/driver/onedrive/api.go +++ b/pkg/filesystem/driver/onedrive/api.go @@ -230,7 +230,7 @@ func (client *Client) UploadChunk(ctx context.Context, uploadURL string, content "Content-Range": {current.RangeHeader()}, }), request.WithoutHeader([]string{"Authorization", "Content-Type"}), - request.WithTimeout(time.Duration(300)*time.Second), + request.WithTimeout(0), ) if err != nil { return nil, fmt.Errorf("failed to upload OneDrive chunk #%d: %w", current.Index(), err) @@ -320,7 +320,7 @@ func (client *Client) SimpleUpload(ctx context.Context, dst string, body io.Read requestURL += ("?@microsoft.graph.conflictBehavior=" + options.conflictBehavior) res, err := client.request(ctx, "PUT", requestURL, body, request.WithContentLength(int64(size)), - request.WithTimeout(time.Duration(150)*time.Second), + request.WithTimeout(0), ) if err != nil { return nil, err