Commit be9cf33e authored by Lukas Böhm's avatar Lukas Böhm 🎱
Browse files

fehlerbehandlung

parent 3732d7c5
......@@ -308,7 +308,6 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError {
if err != nil {
return &HTTPError{ err, "error opening file", 500}
}
defer fileToZip.Close()
info, err := fileToZip.Stat()
if err != nil {
......@@ -327,7 +326,13 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError {
if err != nil {
return &HTTPError{ err, "error creating header", 500 }
}
_, err = io.Copy(writer, fileToZip)
if _, err := io.Copy(writer, fileToZip); err != nil{
return &HTTPError{ err, "error copying file into zip archive", 500 }
}
if err := fileToZip.Close(); err != nil {
return &HTTPError{ err, "error closing zip archive", 500 }
}
}
err = zipWriter.Close()
if err != nil {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment