From 24789fb8558e57868c7510b04d728685edbb8c97 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Thu, 23 Oct 2025 11:03:27 +0200 Subject: [PATCH] Defer UploadCancel after UploadInit to be sure that the upload is cancelled after the function is done --- codex/upload.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codex/upload.go b/codex/upload.go index 4696721..532879d 100644 --- a/codex/upload.go +++ b/codex/upload.go @@ -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))