mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-11-25 21:50:18 +01:00
fix missed errors (#417)
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
This commit is contained in:
parent
e5455d9713
commit
92948fab23
1 changed files with 10 additions and 0 deletions
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue