mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-20 17:16:46 +00:00
GODT-1175: report bug
This commit is contained in:
@ -27,17 +27,23 @@ func (m *manager) ReportBug(ctx context.Context, rep ReportBugReq) error {
|
||||
rep.ClientType = EmailClientType
|
||||
}
|
||||
|
||||
r := m.r(ctx)
|
||||
if len(rep.Attachments) == 0 {
|
||||
r = r.SetBody(rep)
|
||||
} else {
|
||||
r = r.SetMultipartFormData(rep.GetMultipartFormData())
|
||||
for _, att := range rep.Attachments {
|
||||
r = r.SetMultipartField(att.name, att.filename, "application/octet-stream", att.body)
|
||||
}
|
||||
if rep.Client == "" {
|
||||
rep.Client = m.cfg.GetUserAgent()
|
||||
}
|
||||
|
||||
if rep.ClientVersion == "" {
|
||||
rep.ClientVersion = m.cfg.AppVersion
|
||||
}
|
||||
|
||||
r := m.r(ctx).SetMultipartFormData(rep.GetMultipartFormData())
|
||||
|
||||
for _, att := range rep.Attachments {
|
||||
r = r.SetMultipartField(att.name, att.filename, "application/octet-stream", att.body)
|
||||
}
|
||||
|
||||
if _, err := wrapNoConnection(r.Post("/reports/bug")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user