Hide true error messages

git-svn-id: file:///srv/svn/repo/marisa/trunk@24 d6811dac-2434-b64a-9ddc-f563ab233461
This commit is contained in:
dev 2021-10-19 06:38:15 +00:00
parent 78f09f6a6a
commit 242b0f76e9

View File

@ -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
}