1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-23 21:30:19 +00:00

Merge pull request #3814 from cloudzhou/patch-2

leak opened file
This commit is contained in:
astaxie
2019-10-10 00:48:24 +08:00
committed by GitHub

View File

@ -175,6 +175,7 @@ func (e *Email) AttachFile(args ...string) (a *Attachment, err error) {
if err != nil {
return
}
defer f.Close()
ct := mime.TypeByExtension(filepath.Ext(filename))
basename := path.Base(filename)
return e.Attach(f, basename, ct, id)