From 5887bc116f00062e3e9c0dcc7cc8eca84f5160ac Mon Sep 17 00:00:00 2001 From: Zachary Walters Date: Fri, 3 Feb 2023 23:43:36 -0600 Subject: chore: remove usages of the deprecated `ioutil` (#7332) Co-authored-by: Joe Chen --- internal/route/lfs/basic.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/route/lfs') diff --git a/internal/route/lfs/basic.go b/internal/route/lfs/basic.go index cbfc724f..0006f174 100644 --- a/internal/route/lfs/basic.go +++ b/internal/route/lfs/basic.go @@ -7,7 +7,6 @@ package lfs import ( "encoding/json" "io" - "io/ioutil" "net/http" "strconv" @@ -82,7 +81,7 @@ func (h *basicHandler) serveUpload(c *macaron.Context, repo *db.Repository, oid _, err := db.LFS.GetObjectByOID(c.Req.Context(), repo.ID, oid) if err == nil { // Object exists, drain the request body and we're good. - _, _ = io.Copy(ioutil.Discard, c.Req.Request.Body) + _, _ = io.Copy(io.Discard, c.Req.Request.Body) c.Req.Request.Body.Close() c.Status(http.StatusOK) return @@ -123,7 +122,8 @@ func (h *basicHandler) serveUpload(c *macaron.Context, repo *db.Repository, oid // POST /{owner}/{repo}.git/info/lfs/object/basic/verify func (*basicHandler) serveVerify(c *macaron.Context, repo *db.Repository) { var request basicVerifyRequest - defer c.Req.Request.Body.Close() + defer func() { _ = c.Req.Request.Body.Close() }() + err := json.NewDecoder(c.Req.Request.Body).Decode(&request) if err != nil { responseJSON(c.Resp, http.StatusBadRequest, responseError{ -- cgit v1.2.3