Skip to content

Commit 3a96e67

Browse files
committed
edit: edit handleBatch
ssh token校验时需要前置校验仓库组织
1 parent 95cae80 commit 3a96e67

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

server/server.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,17 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
142142
return
143143
}
144144

145-
if err = auth.CheckRepoOwner(userInRepo); req.Operation == "upload" || err != nil {
145+
if err = auth.CheckRepoOwner(userInRepo); req.Operation == "upload" || (err != nil && strings.HasPrefix(err.Error(), "not_found")) {
146146
err := s.dealWithAuthError(userInRepo, w, r)
147147
if err != nil {
148148
return
149149
}
150+
} else if err != nil {
151+
return
152+
} else {
153+
resp := s.handleRequestObject(req)
154+
must(json.NewEncoder(w).Encode(resp))
150155
}
151-
152-
resp := s.handleRequestObject(req)
153-
must(json.NewEncoder(w).Encode(resp))
154156
}
155157

156158
func (s *server) handleRequestObject(req batch.Request) batch.Response {

0 commit comments

Comments
 (0)