aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-05-30 17:38:44 +0100
committerGitHub <noreply@github.com>2021-05-30 17:38:44 +0100
commit36dce0e457d99ae22530f606ce296ef4946b257b (patch)
tree88cebf30651784a5d3f565bef178ea565dbd76fe /routers/repo
parenteffad26c0e7348d27f7fdd1c0cbf120d7558cf67 (diff)
downloadgitea-36dce0e457d99ae22530f606ce296ef4946b257b.tar.gz
gitea-36dce0e457d99ae22530f606ce296ef4946b257b.zip
Close the dataRC reader sooner (#16023)
Fix #15932 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/editor.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go
index 2cc5c1e7f2..2a2c56952d 100644
--- a/routers/repo/editor.go
+++ b/routers/repo/editor.go
@@ -106,6 +106,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
ctx.NotFound("blob.Data", err)
return
}
+
defer dataRc.Close()
ctx.Data["FileSize"] = blob.Size()
@@ -122,6 +123,10 @@ func editFile(ctx *context.Context, isNewFile bool) {
}
d, _ := ioutil.ReadAll(dataRc)
+ if err := dataRc.Close(); err != nil {
+ log.Error("Error whilst closing blob data: %v", err)
+ }
+
buf = append(buf, d...)
if content, err := charset.ToUTF8WithErr(buf); err != nil {
log.Error("ToUTF8WithErr: %v", err)