aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/editor.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-10-24 23:12:43 +0200
committerGitHub <noreply@github.com>2021-10-24 22:12:43 +0100
commitf99d50fc9f8baf406f32a491b214f8a13617d086 (patch)
treeb3cd8a1304e522f111690e9f68130e663012bb16 /routers/web/repo/editor.go
parent932780c2bbae09f052e2fcd1a0701966483496e8 (diff)
downloadgitea-f99d50fc9f8baf406f32a491b214f8a13617d086.tar.gz
gitea-f99d50fc9f8baf406f32a491b214f8a13617d086.zip
Read expected buffer size (#17409)
* Read expected buffer size. * Changed name.
Diffstat (limited to 'routers/web/repo/editor.go')
-rw-r--r--routers/web/repo/editor.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go
index 1d18bfe9a9..f272583499 100644
--- a/routers/web/repo/editor.go
+++ b/routers/web/repo/editor.go
@@ -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]
}