Close the dataRC reader sooner (#16023)
Fix #15932 Signed-off-by: Andrew Thornton <art27@cantab.net>release/v1.15
parent
effad26c0e
commit
36dce0e457
|
@ -106,6 +106,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
||||||
ctx.NotFound("blob.Data", err)
|
ctx.NotFound("blob.Data", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
defer dataRc.Close()
|
defer dataRc.Close()
|
||||||
|
|
||||||
ctx.Data["FileSize"] = blob.Size()
|
ctx.Data["FileSize"] = blob.Size()
|
||||||
|
@ -122,6 +123,10 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
d, _ := ioutil.ReadAll(dataRc)
|
d, _ := ioutil.ReadAll(dataRc)
|
||||||
|
if err := dataRc.Close(); err != nil {
|
||||||
|
log.Error("Error whilst closing blob data: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
buf = append(buf, d...)
|
buf = append(buf, d...)
|
||||||
if content, err := charset.ToUTF8WithErr(buf); err != nil {
|
if content, err := charset.ToUTF8WithErr(buf); err != nil {
|
||||||
log.Error("ToUTF8WithErr: %v", err)
|
log.Error("ToUTF8WithErr: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue