Skip to content

Commit 87f02d9

Browse files
6543zeripath
andauthored
Escape provider name in oauth2 provider redirect (#12650)
Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: Andrew Thornton <[email protected]>
1 parent 21cd7ab commit 87f02d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/auth/oauth2/oauth2.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package oauth2
66

77
import (
88
"net/http"
9+
"net/url"
910

1011
"code.gitea.io/gitea/modules/log"
1112
"code.gitea.io/gitea/modules/setting"
@@ -119,7 +120,7 @@ func RemoveProvider(providerName string) {
119120

120121
// used to create different types of goth providers
121122
func createProvider(providerName, providerType, clientID, clientSecret, openIDConnectAutoDiscoveryURL string, customURLMapping *CustomURLMapping) (goth.Provider, error) {
122-
callbackURL := setting.AppURL + "user/oauth2/" + providerName + "/callback"
123+
callbackURL := setting.AppURL + "user/oauth2/" + url.PathEscape(providerName) + "/callback"
123124

124125
var provider goth.Provider
125126
var err error

0 commit comments

Comments
 (0)