Cleanup code and improve error messages

This commit is contained in:
Remco 2017-03-22 22:28:40 +01:00
parent 9541414476
commit 8ec4d5dbb7
2 changed files with 2 additions and 3 deletions

View file

@ -290,7 +290,7 @@ func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {
n, err := io.CopyN(&b, f, _24K+1) n, err := io.CopyN(&b, f, _24K+1)
if err != nil && err != io.EOF { if err != nil && err != io.EOF {
log.Printf("%s", err.Error()) log.Printf("Error putting new file: %s", err.Error())
http.Error(w, err.Error(), 500) http.Error(w, err.Error(), 500)
return return
} }

View file

@ -132,7 +132,6 @@ func UseLetsEncrypt(hosts []string) OptionFn {
found := false found := false
for _, h := range hosts { for _, h := range hosts {
fmt.Println(h)
found = found || strings.HasSuffix(host, h) found = found || strings.HasSuffix(host, h)
} }
@ -294,7 +293,7 @@ func (s *Server) Run() {
mime.AddExtensionType(".md", "text/x-markdown") mime.AddExtensionType(".md", "text/x-markdown")
log.Printf("Transfer.sh server started. :\nlistening on port: %v\nusing temp folder: %s\nusing storage provider: %s", s.ListenerString, s.tempPath, s.storage.Type()) log.Printf("Transfer.sh server started.\nlistening on port: %v\nusing temp folder: %s\nusing storage provider: %s", s.ListenerString, s.tempPath, s.storage.Type())
log.Printf("---------------------------") log.Printf("---------------------------")
h := handlers.PanicHandler(handlers.LogHandler(LoveHandler(s.RedirectHandler(r)), handlers.NewLogOptions(log.Printf, "_default_")), nil) h := handlers.PanicHandler(handlers.LogHandler(LoveHandler(s.RedirectHandler(r)), handlers.NewLogOptions(log.Printf, "_default_")), nil)