router: close body once finished
This commit is contained in:
parent
1bc77dc969
commit
14eea3b1e4
|
@ -147,6 +147,7 @@ func postServerRestoreBackup(c *gin.Context) {
|
||||||
middleware.CaptureAndAbort(c, err)
|
middleware.CaptureAndAbort(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
// Don't allow content types that we know are going to give us problems.
|
// Don't allow content types that we know are going to give us problems.
|
||||||
if res.Header.Get("Content-Type") == "" || !strings.Contains("application/x-gzip application/gzip", res.Header.Get("Content-Type")) {
|
if res.Header.Get("Content-Type") == "" || !strings.Contains("application/x-gzip application/gzip", res.Header.Get("Content-Type")) {
|
||||||
_ = res.Body.Close()
|
_ = res.Body.Close()
|
||||||
|
|
|
@ -183,7 +183,7 @@ func (fs *Filesystem) DirectorySize(dir string) (int64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !e.IsDir() {
|
if !e.IsDir() {
|
||||||
syscall.Lstat(p, &st)
|
_ = syscall.Lstat(p, &st)
|
||||||
atomic.AddInt64(&size, st.Size)
|
atomic.AddInt64(&size, st.Size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user