Fix panic
This commit is contained in:
parent
6b325234db
commit
015f7c45be
8
img.go
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")
|
||||
|
Loading…
Reference in New Issue
Block a user