Read expected buffer size (#17409)
* Read expected buffer size. * Changed name.
This commit is contained in:
parent
932780c2bb
commit
f99d50fc9f
11 changed files with 51 additions and 29 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue