Defer UploadCancel after UploadInit to be sure that the upload is cancelled after the function is done

This commit is contained in:
Arnaud 2025-10-23 11:03:27 +02:00
parent d2d8802245
commit 24789fb855
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F

View File

@ -171,6 +171,7 @@ func (node CodexNode) UploadReader(ctx context.Context, options UploadOptions, r
if err != nil {
return "", err
}
defer node.UploadCancel(sessionId)
buf := make([]byte, options.ChunkSize.valOrDefault())
total := 0
@ -297,6 +298,7 @@ func (node CodexNode) UploadFile(ctx context.Context, options UploadOptions) (st
if err != nil {
return "", err
}
defer node.UploadCancel(sessionId)
var cSessionId = C.CString(sessionId)
defer C.free(unsafe.Pointer(cSessionId))