Skip to content

Commit 36dce0e

Browse files
authored
Close the dataRC reader sooner (#16023)
Fix #15932 Signed-off-by: Andrew Thornton <[email protected]>
1 parent effad26 commit 36dce0e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

routers/repo/editor.go

+5
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
106106
ctx.NotFound("blob.Data", err)
107107
return
108108
}
109+
109110
defer dataRc.Close()
110111

111112
ctx.Data["FileSize"] = blob.Size()
@@ -122,6 +123,10 @@ func editFile(ctx *context.Context, isNewFile bool) {
122123
}
123124

124125
d, _ := ioutil.ReadAll(dataRc)
126+
if err := dataRc.Close(); err != nil {
127+
log.Error("Error whilst closing blob data: %v", err)
128+
}
129+
125130
buf = append(buf, d...)
126131
if content, err := charset.ToUTF8WithErr(buf); err != nil {
127132
log.Error("ToUTF8WithErr: %v", err)

0 commit comments

Comments
 (0)