dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 64cc6300564e09721d458dfb71cbbcdd347a65b1
parent cc42dc8c15c9bc9537f09648c2199294bc668deb
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 30 Jan 2023 16:56:41 -0800

handle errors

Diffstat:
Mcmd/dkfupload/main.go | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/cmd/dkfupload/main.go b/cmd/dkfupload/main.go @@ -105,9 +105,16 @@ func main() { body := new(bytes.Buffer) w := multipart.NewWriter(body) partFileName := fmt.Sprintf("part_%d", chunkNum) - part, _ := w.CreateFormFile("file", partFileName) - _, _ = part.Write(buf[:n]) - _ = w.Close() + part, err := w.CreateFormFile("file", partFileName) + if err != nil { + return err + } + if _, err := part.Write(buf[:n]); err != nil { + return err + } + if err := w.Close(); err != nil { + return err + } req, _ := http.NewRequest(http.MethodPost, baseUrl+"/file-drop/"+filedropUUID, body) req.Header.Set("User-Agent", userAgent)