Ensure files are closed after they are done being used

This commit is contained in:
Matthew Penner
2023-01-17 18:34:08 -07:00
parent 43b7aa2536
commit e9b8b11fec
4 changed files with 7 additions and 1 deletions

View File

@@ -95,6 +95,7 @@ func getDownloadFile(c *gin.Context) {
middleware.CaptureAndAbort(c, err)
return
}
defer f.Close()
c.Header("Content-Length", strconv.Itoa(int(st.Size())))
c.Header("Content-Disposition", "attachment; filename="+strconv.Quote(st.Name()))