Fix panic

This commit is contained in:
kayos@tcp.direct 2022-07-14 16:08:56 -07:00
parent 6b325234db
commit 015f7c45be
Signed by: kayos
GPG Key ID: 4B841471B4BEE979

8
img.go

@ -190,9 +190,13 @@ func imgPost(c *gin.Context) {
f, err := c.FormFile("upload")
if err != nil || f == nil {
errThrow(c, http.StatusBadRequest, err, "invalid request")
return
}
slog.Debug().Str("filename", f.Filename).Msg("[+] New upload")
if f.Size < 128 {
errThrow(c, http.StatusBadRequest, err, "invalid request")
return
}
// read the incoming file into an io file reader
file, err := f.Open()
@ -207,6 +211,8 @@ func imgPost(c *gin.Context) {
return
}
slog.Debug().Str("filename", f.Filename).Msg("[+] New upload")
Hashr, err := blake2b.New(64, nil)
if err != nil {
errThrow(c, http.StatusInternalServerError, err, "internal server error")