From e837ae94b5726e3852752d95f22e087a94398a91 Mon Sep 17 00:00:00 2001 From: rune Date: Mon, 8 Apr 2024 18:23:05 +0800 Subject: [PATCH] fix ContainsRedirectURI() fix https://github.com/go-gitea/gitea/issues/26897 --- models/auth/oauth2.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/auth/oauth2.go b/models/auth/oauth2.go index 9d53fffc78695..a7f1a4064b616 100644 --- a/models/auth/oauth2.go +++ b/models/auth/oauth2.go @@ -138,6 +138,9 @@ func (app *OAuth2Application) TableName() string { // ContainsRedirectURI checks if redirectURI is allowed for app func (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool { contains := func(s string) bool { + if idx := strings.Index(s, "?"); idx > 0 { + s = s[:idx] + } s = strings.TrimSuffix(strings.ToLower(s), "/") for _, u := range app.RedirectURIs { if strings.TrimSuffix(strings.ToLower(u), "/") == s {