Skip to content

Commit 87d405c

Browse files
committed
fix: ua为空时索引溢出
1 parent effa175 commit 87d405c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ func proxy(c *gin.Context, u string, followRedirect bool) error {
275275

276276
switch resp.StatusCode {
277277
case http.StatusOK, http.StatusPartialContent:
278-
if env == "dev" || req.Header.Get("User-Agent")[:3] == "git" {
278+
ua := req.Header.Get("User-Agent")
279+
if env == "dev" || (len(ua) > 3 && ua[:3] == "git") {
279280
handleResponse(c, resp)
280281

281282
return nil

0 commit comments

Comments
 (0)