diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-01-07 03:23:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 19:23:57 +0000 |
commit | 3c96a3716288b0ae1ae65df44cc92218b489b77f (patch) | |
tree | 014f698c969dfaad3602681e07140f75263889a9 /modules/lfs/server.go | |
parent | 8688c2be95f1d11fadd6cbb979eafe0bb817589a (diff) | |
download | gitea-3c96a3716288b0ae1ae65df44cc92218b489b77f.tar.gz gitea-3c96a3716288b0ae1ae65df44cc92218b489b77f.zip |
Some code improvements (#14266)
Diffstat (limited to 'modules/lfs/server.go')
-rw-r--r-- | modules/lfs/server.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/lfs/server.go b/modules/lfs/server.go index b093213643..226bcbf55a 100644 --- a/modules/lfs/server.go +++ b/modules/lfs/server.go @@ -413,9 +413,8 @@ func PutHandler(ctx *context.Context) { } contentStore := &ContentStore{ObjectStorage: storage.LFS} - bodyReader := ctx.Req.Body().ReadCloser() - defer bodyReader.Close() - if err := contentStore.Put(meta, bodyReader); err != nil { + defer ctx.Req.Request.Body.Close() + if err := contentStore.Put(meta, ctx.Req.Request.Body); err != nil { // Put will log the error itself ctx.Resp.WriteHeader(500) if err == errSizeMismatch || err == errHashMismatch { |