diff --git a/pkg/pmapi/attachments.go b/pkg/pmapi/attachments.go index bbf2613b..00ca6e9a 100644 --- a/pkg/pmapi/attachments.go +++ b/pkg/pmapi/attachments.go @@ -186,8 +186,8 @@ func (c *client) CreateAttachment(att *Attachment, r io.Reader, sig io.Reader) ( } cx, cancel := context.WithCancel(req.Context()) - req = req.WithContext(cx) defer cancel() + req = req.WithContext(cx) // We will write the request as long as it is sent to the API. var res CreateAttachmentRes