Don't expose error (#254)

* share: remove share link when it has been moved

* http: don't expose error
pull/255/head
Equim 2017-10-14 17:07:01 +08:00 committed by Henrique Dias
parent 7f7d536c5e
commit 538b99ee77
1 changed files with 4 additions and 6 deletions

View File

@ -25,16 +25,13 @@ func Handler(m *fm.FileManager) http.Handler {
if code >= 400 { if code >= 400 {
w.WriteHeader(code) w.WriteHeader(code)
if err == nil { txt := http.StatusText(code)
txt := http.StatusText(code) log.Printf("%v: %v %v\n", r.URL.Path, code, txt)
log.Printf("%v: %v %v\n", r.URL.Path, code, txt) w.Write([]byte(txt + "\n"))
w.Write([]byte(txt))
}
} }
if err != nil { if err != nil {
log.Print(err) log.Print(err)
w.Write([]byte(err.Error()))
} }
}) })
} }
@ -270,6 +267,7 @@ func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, erro
info, err := os.Stat(s.Path) info, err := os.Stat(s.Path)
if err != nil { if err != nil {
c.Store.Share.Delete(s.Hash)
return ErrorToHTTP(err, false), err return ErrorToHTTP(err, false), err
} }