diff --git a/internal/frontend/qt-ie/frontend.go b/internal/frontend/qt-ie/frontend.go index f8092159..208f321e 100644 --- a/internal/frontend/qt-ie/frontend.go +++ b/internal/frontend/qt-ie/frontend.go @@ -311,6 +311,9 @@ func (f *FrontendQt) sendBug(description, emailClient, address string) bool { if f.Accounts.Model.Count() > 0 { accname = f.Accounts.Model.Get(0).Account() } + if accname == "" { + accname = "Unknown account" + } if err := f.ie.ReportBug( core.QSysInfo_ProductType(), diff --git a/internal/frontend/qt/frontend.go b/internal/frontend/qt/frontend.go index 2dbb75a8..177d48c4 100644 --- a/internal/frontend/qt/frontend.go +++ b/internal/frontend/qt/frontend.go @@ -466,6 +466,9 @@ func (s *FrontendQt) sendBug(description, client, address string) (isOK bool) { if s.Accounts.Count() > 0 { accname = s.Accounts.get(0).Account() } + if accname == "" { + accname = "Unknown account" + } if err := s.bridge.ReportBug( core.QSysInfo_ProductType(), core.QSysInfo_PrettyProductName(), diff --git a/pkg/pmapi/attachments.go b/pkg/pmapi/attachments.go index c0848d96..bbf2613b 100644 --- a/pkg/pmapi/attachments.go +++ b/pkg/pmapi/attachments.go @@ -18,6 +18,7 @@ package pmapi import ( + "context" "encoding/base64" "encoding/json" "errors" @@ -178,12 +179,16 @@ func writeAttachment(w *multipart.Writer, att *Attachment, r io.Reader, sig io.R // CreateAttachment uploads an attachment. It must be already encrypted and contain a MessageID. // // The returned created attachment contains the new attachment ID and its size. -func (c *client) CreateAttachment(att *Attachment, r io.Reader, sig io.Reader) (created *Attachment, err error) { +func (c *client) CreateAttachment(att *Attachment, r io.Reader, sig io.Reader) (*Attachment, error) { req, w, err := c.NewMultipartRequest("POST", "/mail/v4/attachments") if err != nil { - return + return nil, err } + cx, cancel := context.WithCancel(req.Context()) + req = req.WithContext(cx) + defer cancel() + // We will write the request as long as it is sent to the API. var res CreateAttachmentRes done := make(chan error, 1) @@ -191,20 +196,20 @@ func (c *client) CreateAttachment(att *Attachment, r io.Reader, sig io.Reader) ( done <- c.DoJSON(req, &res) })() - if err = writeAttachment(w.Writer, att, r, sig); err != nil { - return + if err := writeAttachment(w.Writer, att, r, sig); err != nil { + _ = w.Close() + return nil, err } _ = w.Close() - if err = <-done; err != nil { - return + if err := <-done; err != nil { + return nil, err } - if err = res.Err(); err != nil { - return + if err := res.Err(); err != nil { + return nil, err } - created = res.Attachment - return + return res.Attachment, nil } type UpdateAttachmentSignatureReq struct { diff --git a/unreleased.md b/unreleased.md index 532ea07c..3e3972ca 100644 --- a/unreleased.md +++ b/unreleased.md @@ -15,6 +15,16 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) * GODT-874 Added manual triggers to Updater module. * GODT-851 Added support of UID EXPUNGE. +### Removed + +### Fixed +* GODT-922 Fix panic during restarting the bridge. +* GODT-945 Fix panic in integration tests caused by concurrent map writes. +* GODT-732 Fix usage of fontawesome. +* GODT-951 Properly parse message with long lines in header and long header split to multiple lines (upgrading to latest go-message). +* GODT-894 Fix panic when sending while account is logging in. +* GODT-831 Fix reporting bug from accounts with empty account name. + ### Changed * GODT-97 Don't log errors caused by SELECT "". * Rename channels `beta->early`, `live->stable`. @@ -31,3 +41,11 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) ### Fixed * GODT-946 Fix flaky tests notifying changes. * GODT-979 Fix panic when trying to parse a multipart/alternative section that has no child sections. +### Changed +* GODT-389 Prefer `From` header instead of `MAIL FROM` address. +* GODT-898 Only set ContentID for inline attachments. +* GODT-773 Replace `INTERNALDATE` older than birthday of RFC822 by birthday of RFC822 to not crash Apple Mail. +* GODT-927 Avoid to call API with empty label name. +* GODT-732 Fix usage of fontawesome +* GODT-915 Bump go-imap dependency and remove go-imap-specialuse dependency. +* GODT-831 Cancel request of uploading attachment if reading/writing it fails.