From 002767897754d3efd6f08e33dcc3fff98bf44dcd Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 20 Aug 2026 15:18:17 +0100 Subject: [PATCH] huaweidrive: simplify chunk size clamping found by "go fix -minmax" --- backend/huaweidrive/huaweidrive.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/backend/huaweidrive/huaweidrive.go b/backend/huaweidrive/huaweidrive.go index 5529f23bc..e9e46367a 100644 --- a/backend/huaweidrive/huaweidrive.go +++ b/backend/huaweidrive/huaweidrive.go @@ -1897,11 +1897,9 @@ func (o *Object) uploadResume(ctx context.Context, in io.Reader, leaf, directory } // Now upload the content in chunks - // Note 256k is the minimum chunk size according to Huawei Drive API - chunkSize := max(int64(o.fs.opt.ChunkSize), 256*1024) - if chunkSize > 64*1024*1024 { - chunkSize = 64 * 1024 * 1024 // Maximum single upload size - } + // Note 256k is the minimum chunk size and 64M the maximum + // single upload size according to the Huawei Drive API + chunkSize := min(max(int64(o.fs.opt.ChunkSize), 256*1024), 64*1024*1024) buf := make([]byte, chunkSize) var offset int64