From 4f8dab8bcec40f34f02074549747437ac17b0bef Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 14 Jun 2023 17:43:26 +0100 Subject: [PATCH] zoho: fix downloads with Range: header returning the wrong data Zoho has started returning the results from Range: requests with a 200 response code rather than the technically correct 206 error code. Before this change this triggered workaround code to deal with Zoho not obeying Range: requests properly. This fix tests the returned header for a Content-Range: header and if it exists assumes it is a valid reply to the Range: request despite the status being 200. This problem was spotted by the integration tests. --- backend/zoho/zoho.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/zoho/zoho.go b/backend/zoho/zoho.go index 25b5d24af..d1172fe98 100644 --- a/backend/zoho/zoho.go +++ b/backend/zoho/zoho.go @@ -1206,7 +1206,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read if err != nil { return nil, err } - if partialContent && resp.StatusCode == 200 { + if partialContent && resp.StatusCode == 200 && resp.Header.Get("Content-Range") == "" { if start > 0 { // We need to read and discard the beginning of the data... _, err = io.CopyN(io.Discard, resp.Body, start)