Skip to content

Commit

Permalink
add: fix-complexity-problem
Browse files Browse the repository at this point in the history
fix-complexity-problem
  • Loading branch information
Zherphy committed Nov 8, 2024
1 parent 5621998 commit 948978d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
userInRepo.Owner = chi.URLParam(r, "owner")
userInRepo.Repo = chi.URLParam(r, "repo")
if err = auth.CheckRepoOwner(userInRepo); req.Operation == "upload" || err != nil {
err = s.dealWithAuthError(userInRepo, w, r, err)
err := s.dealWithAuthError(userInRepo, w, r)
if err != nil {
return
}
Expand Down Expand Up @@ -165,7 +165,8 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
must(json.NewEncoder(w).Encode(resp))
}

func (s *server) dealWithAuthError(userInRepo auth.UserInRepo, w http.ResponseWriter, r *http.Request, err error) error {
func (s *server) dealWithAuthError(userInRepo auth.UserInRepo, w http.ResponseWriter, r *http.Request) error {
var err error
if username, password, ok := r.BasicAuth(); ok {
userInRepo.Username = username
userInRepo.Password = password
Expand Down

0 comments on commit 948978d

Please sign in to comment.