We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9daebc commit d0ff409Copy full SHA for d0ff409
routers/repo/editor.go
@@ -106,7 +106,13 @@ func editFile(ctx *context.Context, isNewFile bool) {
106
ctx.NotFound("blob.Data", err)
107
return
108
}
109
- defer dataRc.Close()
+ closed := false
110
+
111
+ defer func() {
112
+ if !closed {
113
+ dataRc.Close()
114
+ }
115
+ }()
116
117
ctx.Data["FileSize"] = blob.Size()
118
ctx.Data["FileName"] = blob.Name()
@@ -122,6 +128,11 @@ func editFile(ctx *context.Context, isNewFile bool) {
122
128
123
129
124
130
d, _ := ioutil.ReadAll(dataRc)
131
+ if err := dataRc.Close(); err != nil {
132
+ log.Error("Error whilst closing blob data: %v", err)
133
134
+ closed = true
135
125
136
buf = append(buf, d...)
126
137
if content, err := charset.ToUTF8WithErr(buf); err != nil {
127
138
log.Error("ToUTF8WithErr: %v", err)
0 commit comments