Fix bug when refresh gitea access token

When the URI has extra '/' in DRONE_GITEA_SERVER, the drone
	will not pull the repo since it cannot refresh the access token.
	The log in gitea shows the drone try to access '//login/oauth/access_token'

	Related to commit 5414bb75f
This commit is contained in:
cmj 2020-02-14 16:01:48 +08:00
parent 1ddf7963fe
commit 3e74e30845

View file

@ -169,7 +169,7 @@ func provideRefresher(config config.Config) *oauth2.Refresher {
return &oauth2.Refresher{
ClientID: config.Gitea.ClientID,
ClientSecret: config.Gitea.ClientSecret,
Endpoint: config.Gitea.Server + "/login/oauth/access_token",
Endpoint: strings.TrimSuffix(config.Gitea.Server, "/") + "/login/oauth/access_token",
Source: oauth2.ContextTokenSource(),
Client: defaultClient(config.Gitea.SkipVerify),
}