mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-10-10 04:53:09 +08:00
eea8fee7f1
The 115 and pikpak multipart uploaders checked for cancellation with a `case <-ctx.Done()` inside a select, and a break there only leaves the select, not the enclosing `for retry := 0; retry < 3; retry++` loop. Cancelling an upload therefore ran all three attempts for every remaining chunk, each allocating a chunk-sized buffer and reading it off disk before firing a request that could not succeed, and reported a transport error instead of the cancellation. Move the check ahead of the select and use utils.IsCanceled, matching the pattern the other drivers already use. Assigning ctx.Err() to err is load-bearing: without it a cancelled chunk takes the success branch, counts toward progress, and appends a zero-value UploadPart. Found with staticcheck (SA4011). Co-authored-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com>