partage

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/partage.git
Log | Files | Refs

commit fa4ac607485696882576db69ad398e4939de2dc8
parent 262be7013fd0288a16ade778c6ad6602b88d7e87
Author: Willy Goiffon <dev@z3bra.org>
Date:   Tue, 19 Oct 2021 08:38:15 +0200

Hide true error messages

Diffstat:
Mpartage.go | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/partage.go b/partage.go @@ -105,7 +105,7 @@ func writemeta(filename string, expiry int64) error { func servetemplate(w http.ResponseWriter, f string, d templatedata) { t, err := template.ParseFiles(conf.templatedir + "/" + f) if err != nil { - http.Error(w, err, http.StatusInternalServerError) + http.Error(w, "Internal error", http.StatusInternalServerError) return } @@ -130,7 +130,7 @@ func uploaderPut(w http.ResponseWriter, r *http.Request) { defer f.Close() if err = writefile(f, r.Body, r.ContentLength); err != nil { - http.Error(w, err, http.StatusInternalServerError) + http.Error(w, "Internal error", http.StatusInternalServerError) defer os.Remove(tmp.Name()) return } @@ -153,7 +153,7 @@ func uploaderPost(w http.ResponseWriter, r *http.Request) { post, err := h.Open() if err != nil { - http.Error(w, err, http.StatusInternalServerError) + http.Error(w, "Internal error", http.StatusInternalServerError) return } defer post.Close() @@ -161,13 +161,13 @@ func uploaderPost(w http.ResponseWriter, r *http.Request) { tmp, _ := ioutil.TempFile(conf.filepath, "*"+path.Ext(h.Filename)) f, err := os.Create(tmp.Name()) if err != nil { - http.Error(w, err, http.StatusInternalServerError) + http.Error(w, "Internal error", http.StatusInternalServerError) return } defer f.Close() if err = writefile(f, post, h.Size); err != nil { - http.Error(w, err, http.StatusInternalServerError) + http.Error(w, "Internal error", http.StatusInternalServerError) defer os.Remove(tmp.Name()) return }