Skip to content

Commit

Permalink
Fix setting of SameSite on cookies (#15989)
Browse files Browse the repository at this point in the history
Fix #15972

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
  • Loading branch information
zeripath and techknowlogick authored May 27, 2021
1 parent 568fe8c commit 6d39053
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/web/middleware/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func SetCookie(resp http.ResponseWriter, name string, value string, others ...in
if len(others) > 2 {
if v, ok := others[2].(string); ok && len(v) > 0 {
cookie.Domain = v
} else if v, ok := others[1].(func(*http.Cookie)); ok {
} else if v, ok := others[2].(func(*http.Cookie)); ok {
v(&cookie)
}
}
Expand All @@ -170,7 +170,7 @@ func SetCookie(resp http.ResponseWriter, name string, value string, others ...in
if len(others) > 4 {
if v, ok := others[4].(bool); ok && v {
cookie.HttpOnly = true
} else if v, ok := others[1].(func(*http.Cookie)); ok {
} else if v, ok := others[4].(func(*http.Cookie)); ok {
v(&cookie)
}
}
Expand All @@ -179,7 +179,7 @@ func SetCookie(resp http.ResponseWriter, name string, value string, others ...in
if v, ok := others[5].(time.Time); ok {
cookie.Expires = v
cookie.RawExpires = v.Format(time.UnixDate)
} else if v, ok := others[1].(func(*http.Cookie)); ok {
} else if v, ok := others[5].(func(*http.Cookie)); ok {
v(&cookie)
}
}
Expand Down

0 comments on commit 6d39053

Please sign in to comment.