1
0
mirror of https://github.com/go-gitea/git.git synced 2026-02-05 06:45:03 +01:00

Improve memory usage in Commit.IsImageFile (#95)

Signed-off-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com>
This commit is contained in:
Duncan Ogilvie
2017-11-28 16:24:08 +01:00
committed by Lauris BH
parent c2040d5d4d
commit 619663493e

View File

@@ -98,10 +98,11 @@ func (c *Commit) IsImageFile(name string) bool {
return false
}
dataRc, err := blob.Data()
dataRc, err := blob.DataAsync()
if err != nil {
return false
}
defer dataRc.Close()
buf := make([]byte, 1024)
n, _ := dataRc.Read(buf)
buf = buf[:n]