Fix invalid input report

This commit is contained in:
Michal Horejsek
2021-01-12 15:37:13 +01:00
parent 1909ceed67
commit 2feaba8888
4 changed files with 39 additions and 10 deletions

View File

@ -311,6 +311,9 @@ func (f *FrontendQt) sendBug(description, emailClient, address string) bool {
if f.Accounts.Model.Count() > 0 { if f.Accounts.Model.Count() > 0 {
accname = f.Accounts.Model.Get(0).Account() accname = f.Accounts.Model.Get(0).Account()
} }
if accname == "" {
accname = "Unknown account"
}
if err := f.ie.ReportBug( if err := f.ie.ReportBug(
core.QSysInfo_ProductType(), core.QSysInfo_ProductType(),

View File

@ -466,6 +466,9 @@ func (s *FrontendQt) sendBug(description, client, address string) (isOK bool) {
if s.Accounts.Count() > 0 { if s.Accounts.Count() > 0 {
accname = s.Accounts.get(0).Account() accname = s.Accounts.get(0).Account()
} }
if accname == "" {
accname = "Unknown account"
}
if err := s.bridge.ReportBug( if err := s.bridge.ReportBug(
core.QSysInfo_ProductType(), core.QSysInfo_ProductType(),
core.QSysInfo_PrettyProductName(), core.QSysInfo_PrettyProductName(),

View File

@ -18,6 +18,7 @@
package pmapi package pmapi
import ( import (
"context"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"errors" "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. // 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. // 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") req, w, err := c.NewMultipartRequest("POST", "/mail/v4/attachments")
if err != nil { 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. // We will write the request as long as it is sent to the API.
var res CreateAttachmentRes var res CreateAttachmentRes
done := make(chan error, 1) 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) done <- c.DoJSON(req, &res)
})() })()
if err = writeAttachment(w.Writer, att, r, sig); err != nil { if err := writeAttachment(w.Writer, att, r, sig); err != nil {
return _ = w.Close()
return nil, err
} }
_ = w.Close() _ = w.Close()
if err = <-done; err != nil { if err := <-done; err != nil {
return return nil, err
} }
if err = res.Err(); err != nil { if err := res.Err(); err != nil {
return return nil, err
} }
created = res.Attachment return res.Attachment, nil
return
} }
type UpdateAttachmentSignatureReq struct { type UpdateAttachmentSignatureReq struct {

View File

@ -15,6 +15,16 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
* GODT-874 Added manual triggers to Updater module. * GODT-874 Added manual triggers to Updater module.
* GODT-851 Added support of UID EXPUNGE. * 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 ### Changed
* GODT-97 Don't log errors caused by SELECT "". * GODT-97 Don't log errors caused by SELECT "".
* Rename channels `beta->early`, `live->stable`. * Rename channels `beta->early`, `live->stable`.
@ -31,3 +41,11 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Fixed ### Fixed
* GODT-946 Fix flaky tests notifying changes. * GODT-946 Fix flaky tests notifying changes.
* GODT-979 Fix panic when trying to parse a multipart/alternative section that has no child sections. * 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.