From 4646bc2efa982f244b433f28c92d4027190a822e Mon Sep 17 00:00:00 2001 From: Derek Weitzel Date: Tue, 10 Oct 2023 13:18:29 -0500 Subject: [PATCH] Remove content length from put to enable chunked Removing the content length from a put changes the upload style from full file upload to a chunked encoded upload. A full file upload causes go to read in the entire file in memory while uploading, chunked does not. --- handle_http.go | 1 - 1 file changed, 1 deletion(-) diff --git a/handle_http.go b/handle_http.go index 55c94a7..3332c38 100644 --- a/handle_http.go +++ b/handle_http.go @@ -728,7 +728,6 @@ func UploadFile(src string, dest *url.URL, token string, namespace namespaces.Na log.Errorln("Error creating request:", err) return 0, err } - request.ContentLength = fileInfo.Size() // Set the authorization header request.Header.Set("Authorization", "Bearer "+token) var lastKnownWritten int64