Fix oauth2 session gob register (#36017)

`gob.Register` must be called before Sessioner

Fix #36016
This commit is contained in:
wxiaoguang authored and GitHub committed 2025-11-26 23:25:34 +08:00
1 parent abe2755f7a
commit 000c06d41b
9 files changed
+22 -27

No files matched your search

+1 -4
View File
@@ -22,9 +22,6 @@ import (
var gothRWMutex = sync.RWMutex{}
// UsersStoreKey is the key for the store
const UsersStoreKey = "gitea-oauth2-sessions"
// ProviderHeaderKey is the HTTP header key
const ProviderHeaderKey = "gitea-oauth2-provider"
@@ -33,7 +30,7 @@ func Init(ctx context.Context) error {
// Lock our mutex
gothRWMutex.Lock()
gob.Register(&sessions.Session{})
gob.Register(&sessions.Session{}) // TODO: CHI-SESSION-GOB-REGISTER. FIXME: it seems to be an abuse, why the Session struct itself is stored in session store again?
gothic.Store = &SessionsStore{
maxLength: int64(setting.OAuth2.MaxTokenLength),