Parcourir la source

Merge pull request #136 from dutchcoders/ISSUE-57

Handle empty upload
tags/v1.0.0
Andrea Spacca il y a 5 ans
committed by GitHub
Parent
révision
bce4eec32c
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. +6
    -0
      server/handlers.go

+ 6
- 0
server/handlers.go Voir le fichier

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


Chargement…
Annuler
Enregistrer