Commit e8b5c73d authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove unnecessary r.Body.Close()

parent c5e8ad40
...@@ -48,11 +48,6 @@ func lfsAuthorizeHandler(handleFunc serviceHandleFunc) serviceHandleFunc { ...@@ -48,11 +48,6 @@ func lfsAuthorizeHandler(handleFunc serviceHandleFunc) serviceHandleFunc {
} }
func handleStoreLfsObject(w http.ResponseWriter, r *gitRequest) { func handleStoreLfsObject(w http.ResponseWriter, r *gitRequest) {
var body io.ReadCloser
body = r.Body
defer body.Close()
file, err := ioutil.TempFile(r.StoreLFSPath, r.LfsOid) file, err := ioutil.TempFile(r.StoreLFSPath, r.LfsOid)
if err != nil { if err != nil {
fail500(w, "Couldn't open tmp file for writing.", err) fail500(w, "Couldn't open tmp file for writing.", err)
...@@ -64,7 +59,7 @@ func handleStoreLfsObject(w http.ResponseWriter, r *gitRequest) { ...@@ -64,7 +59,7 @@ func handleStoreLfsObject(w http.ResponseWriter, r *gitRequest) {
hash := sha256.New() hash := sha256.New()
hw := io.MultiWriter(hash, file) hw := io.MultiWriter(hash, file)
written, err := io.Copy(hw, body) written, err := io.Copy(hw, r.Body)
if err != nil { if err != nil {
fail500(w, "Failed to save received LFS object.", err) fail500(w, "Failed to save received LFS object.", err)
return return
......
Markdown is supported
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