1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 23:17:19 +00:00

Ensure Request Body Readers are closed in LFS server (#8454)

This commit is contained in:
zeripath
2019-10-10 18:42:28 +01:00
committed by GitHub
parent df2c11a878
commit 6551a9d6ca
2 changed files with 15 additions and 5 deletions

View File

@@ -155,7 +155,9 @@ func PostLockHandler(ctx *context.Context) {
}
var req api.LFSLockRequest
dec := json.NewDecoder(ctx.Req.Body().ReadCloser())
bodyReader := ctx.Req.Body().ReadCloser()
defer bodyReader.Close()
dec := json.NewDecoder(bodyReader)
if err := dec.Decode(&req); err != nil {
writeStatus(ctx, 400)
return
@@ -269,7 +271,9 @@ func UnLockHandler(ctx *context.Context) {
}
var req api.LFSLockDeleteRequest
dec := json.NewDecoder(ctx.Req.Body().ReadCloser())
bodyReader := ctx.Req.Body().ReadCloser()
defer bodyReader.Close()
dec := json.NewDecoder(bodyReader)
if err := dec.Decode(&req); err != nil {
writeStatus(ctx, 400)
return