Update some forgotten items.
This commit is contained in:
parent
a45216f441
commit
f2cd95670d
4 changed files with 19 additions and 29 deletions
13
bot.go
13
bot.go
|
@ -198,18 +198,7 @@ func (bot *BotAPI) UploadFiles(endpoint string, params Params, files []RequestFi
|
|||
return
|
||||
}
|
||||
|
||||
if f.Size != -1 {
|
||||
io.Copy(part, f.Reader)
|
||||
} else {
|
||||
data, err := ioutil.ReadAll(f.Reader)
|
||||
if err != nil {
|
||||
w.CloseWithError(err)
|
||||
return
|
||||
}
|
||||
|
||||
buf := bytes.NewBuffer(data)
|
||||
io.Copy(part, buf)
|
||||
}
|
||||
io.Copy(part, f.Reader)
|
||||
case FileURL:
|
||||
val := string(f)
|
||||
if err := m.WriteField(file.Name, val); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue