From 2abeda5961615c304348c4886a1d42f4ae30c876 Mon Sep 17 00:00:00 2001 From: Volodymyr <142890760+vkit-maytech@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:44:45 +0200 Subject: [PATCH] quatrix: fix Content-Range header This change does not actually affect uploads. Just to be right according to definition of Content-Range in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range#range-end --- backend/quatrix/quatrix.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/quatrix/quatrix.go b/backend/quatrix/quatrix.go index dab1f5f77..e615ac49e 100644 --- a/backend/quatrix/quatrix.go +++ b/backend/quatrix/quatrix.go @@ -1198,11 +1198,12 @@ func (o *Object) uploadSession(ctx context.Context, parentID, name string) (uplo func (o *Object) upload(ctx context.Context, uploadKey string, chunk io.Reader, fullSize int64, offset int64, chunkSize int64, options ...fs.OpenOption) (err error) { opts := rest.Opts{ - Method: "POST", - RootURL: fmt.Sprintf(uploadURL, o.fs.opt.Host) + uploadKey, - Body: chunk, - ContentRange: fmt.Sprintf("bytes %d-%d/%d", offset, offset+chunkSize, fullSize), - Options: options, + Method: "POST", + RootURL: fmt.Sprintf(uploadURL, o.fs.opt.Host) + uploadKey, + Body: chunk, + ContentLength: &chunkSize, + ContentRange: fmt.Sprintf("bytes %d-%d/%d", offset, offset+chunkSize-1, fullSize), + Options: options, } var fileID string