mirror of
https://git.freecumextremist.com/grumbulon/pomme.git
synced 2024-11-22 04:03:46 +00:00
move defer file.Close() to before validateContentType because that could cause problems
This commit is contained in:
parent
320f757917
commit
7e6594f3c7
1 changed files with 2 additions and 1 deletions
|
@ -65,13 +65,14 @@ func ReceiveFile(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
defer file.Close() //nolint: errcheck
|
||||
|
||||
ok := validateContentType(file)
|
||||
if !ok {
|
||||
http.Error(w, "file must be text/plain", http.StatusUnsupportedMediaType)
|
||||
|
||||
return
|
||||
}
|
||||
defer file.Close() //nolint: errcheck
|
||||
|
||||
name := strings.Split(header.Filename, ".")
|
||||
|
||||
|
|
Loading…
Reference in a new issue