Merge pull request #136 from dutchcoders/ISSUE-57

Handle empty upload
This commit is contained in:
Andrea Spacca 2018-07-07 11:15:22 +02:00 committed by GitHub
commit bce4eec32c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 == "" {