--- a/youtrack/attachment.go Tue Jan 14 04:41:41 2020 -0600
+++ b/youtrack/attachment.go Tue Jan 14 04:59:25 2020 -0600
@@ -3,9 +3,12 @@
@@ -43,8 +46,34 @@
return a.payload.String(), nil
+var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"") +func escapeQuotes(s string) string { + return quoteEscaper.Replace(s) func (a *Attachment) AddFile(r io.ReadCloser, filename string) error {
- w, err := a.writer.CreateFormFile(filename, filename)
+ header := textproto.MIMEHeader{} + fmt.Sprintf("form-data; name=%q; filename=%q", + escapeQuotes(filename), + escapeQuotes(filename), + ext := filepath.Ext(filename) + contentType = mime.TypeByExtension(ext) + contentType = "application/octet-stream" + header.Set("Content-Type", contentType) + w, err := a.writer.CreatePart(header)