From f99d50fc9f8baf406f32a491b214f8a13617d086 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Sun, 24 Oct 2021 23:12:43 +0200 Subject: Read expected buffer size (#17409) * Read expected buffer size. * Changed name. --- modules/git/blob.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/git') diff --git a/modules/git/blob.go b/modules/git/blob.go index c7919f3c41..9567affd03 100644 --- a/modules/git/blob.go +++ b/modules/git/blob.go @@ -11,6 +11,7 @@ import ( "io" "code.gitea.io/gitea/modules/typesniffer" + "code.gitea.io/gitea/modules/util" ) // This file contains common functions between the gogit and !gogit variants for git Blobs @@ -28,7 +29,7 @@ func (b *Blob) GetBlobContent() (string, error) { } defer dataRc.Close() buf := make([]byte, 1024) - n, _ := dataRc.Read(buf) + n, _ := util.ReadAtMost(dataRc, buf) buf = buf[:n] return string(buf), nil } -- cgit v1.2.3