mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 08:48:37 +00:00
Read expected buffer size (#17409)
* Read expected buffer size. * Changed name.
This commit is contained in:
@@ -118,7 +118,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
||||
ctx.Data["FileName"] = blob.Name()
|
||||
|
||||
buf := make([]byte, 1024)
|
||||
n, _ := dataRc.Read(buf)
|
||||
n, _ := util.ReadAtMost(dataRc, buf)
|
||||
buf = buf[:n]
|
||||
|
||||
// Only some file types are editable online as text.
|
||||
@@ -751,7 +751,7 @@ func UploadFileToServer(ctx *context.Context) {
|
||||
defer file.Close()
|
||||
|
||||
buf := make([]byte, 1024)
|
||||
n, _ := file.Read(buf)
|
||||
n, _ := util.ReadAtMost(file, buf)
|
||||
if n > 0 {
|
||||
buf = buf[:n]
|
||||
}
|
||||
|
Reference in New Issue
Block a user