From 714d368886bc10ee43d1d95a945155a982c216b9 Mon Sep 17 00:00:00 2001 From: CNA-Bld Date: Tue, 22 Feb 2022 00:41:46 +0800 Subject: [PATCH] Fix file handling in WriteToHTTPResponse #356 updates the logic to support uploading multiple files but accidentally breaks this. --- bot.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bot.go b/bot.go index c58afec4..8f933ff2 100644 --- a/bot.go +++ b/bot.go @@ -539,9 +539,15 @@ func WriteToHTTPResponse(w http.ResponseWriter, c Chattable) error { } if t, ok := c.(Fileable); ok { - if hasFilesNeedingUpload(t.files()) { + files := t.files() + + if hasFilesNeedingUpload(files) { return errors.New("unable to use http response to upload files") } + + for _, file := range files { + params[file.Name] = file.Data.SendData() + } } values := buildParams(params)