fix missed errors (#417)

Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
This commit is contained in:
Masaya Watanabe 2021-10-16 16:57:59 +09:00 committed by GitHub
parent e5455d9713
commit 92948fab23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -344,6 +344,11 @@ func (s *Server) postHandler(w http.ResponseWriter, r *http.Request) {
}
reader, err = os.Open(file.Name())
if err != nil {
s.logger.Printf("%s", err.Error())
http.Error(w, err.Error(), 500)
return
}
} else {
reader = bytes.NewReader(b.Bytes())
}
@ -493,6 +498,11 @@ func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {
}
reader, err = os.Open(file.Name())
if err != nil {
s.logger.Printf("%s", err.Error())
http.Error(w, err.Error(), 500)
return
}
} else {
reader = bytes.NewReader(b.Bytes())
}