From 79d4369a680c17ed6fa9a0a22033447b0335d4ad Mon Sep 17 00:00:00 2001 From: Zherphy Date: Fri, 8 Nov 2024 11:30:47 +0800 Subject: [PATCH] fix: fix complexity problem fix complexity problem generateDownloadUrl --- server/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/server.go b/server/server.go index 38d1c78..b2aef97 100644 --- a/server/server.go +++ b/server/server.go @@ -157,13 +157,12 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) { return } } - - var resp batch.Response - s.operateRequestObject(resp, req) + resp := s.operateRequestObject(req) must(json.NewEncoder(w).Encode(resp)) } -func (s *server) operateRequestObject(resp batch.Response, req batch.Request) { +func (s *server) operateRequestObject(req batch.Request) batch.Response { + var resp batch.Response for _, in := range req.Objects { resp.Objects = append(resp.Objects, batch.Object{ OID: in.OID, @@ -243,6 +242,7 @@ func (s *server) operateRequestObject(resp batch.Response, req batch.Request) { } } } + return resp } // 生成下载对象的带授权信息的URL