Explorar o código

Revert one usecase

LEGOlord208 %!s(int64=7) %!d(string=hai) anos
pai
achega
9a36098f5c
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      restapi.go

+ 4 - 3
restapi.go

@@ -1383,9 +1383,10 @@ func (s *Session) ChannelMessageSendComplex(channelID string, data *MessageSend)
 		for i, file := range files {
 			h := make(textproto.MIMEHeader)
 			h.Set("Content-Disposition",
-				`form-data; name="file`+strconv.Itoa(i)+
-					`"; filename="`+quoteEscaper.Replace(file.Name)+
-					`"`)
+				fmt.Sprintf(`form-data; name="file%d"; filename="%s"`,
+					i,
+					quoteEscaper.Replace(file.Name),
+				))
 			contentType := file.ContentType
 			if contentType == "" {
 				contentType = "application/octet-stream"