diff options
author | zeripath <art27@cantab.net> | 2021-05-27 02:01:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 21:01:07 -0400 |
commit | 6d39053711451752aa9404a7ad840c067db81153 (patch) | |
tree | 6d77decd176a4668cb3433b3a265e468125db488 /modules | |
parent | 568fe8c595eea84eb3e3a49839df80686fc5d640 (diff) | |
download | gitea-6d39053711451752aa9404a7ad840c067db81153.tar.gz gitea-6d39053711451752aa9404a7ad840c067db81153.zip |
Fix setting of SameSite on cookies (#15989)
Fix #15972
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/web/middleware/cookie.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/web/middleware/cookie.go b/modules/web/middleware/cookie.go index cfcc2bbac7..f44d2c3688 100644 --- a/modules/web/middleware/cookie.go +++ b/modules/web/middleware/cookie.go @@ -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) } } @@ -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) } } @@ -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) } } |