Преглед изворни кода

Handle empty upload

tags/v1.0.0
Andrea Spacca пре 5 година
родитељ
комит
163faf569a
1 измењених фајлова са 6 додато и 0 уклоњено
  1. +6
    -0
      server/handlers.go

+ 6
- 0
server/handlers.go Прегледај датотеку

@@ -397,6 +397,12 @@ func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {
contentLength = n
}

if contentLength == 0 {
log.Print("Empty content-length")
http.Error(w, errors.New("Could not uplpoad empty file").Error(), 400)
return
}

contentType := r.Header.Get("Content-Type")

if contentType == "" {


Loading…
Откажи
Сачувај