mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 08:02:18 +02:00
Add gitea/forgejo driver check, to handle ErrUnknownVersion error (#3243)
close #3240
This commit is contained in:
parent
b24970f358
commit
8ca51971be
@ -586,7 +586,8 @@ func (c *Gitea) newClientToken(ctx context.Context, token string) (*gitea.Client
|
||||
}
|
||||
}
|
||||
client, err := gitea.NewClient(c.url, gitea.SetToken(token), gitea.SetHTTPClient(httpClient), gitea.SetContext(ctx))
|
||||
if err != nil && strings.Contains(err.Error(), "Malformed version") {
|
||||
if err != nil &&
|
||||
(errors.Is(err, &gitea.ErrUnknownVersion{}) || strings.Contains(err.Error(), "Malformed version")) {
|
||||
// we guess it's a dev gitea version
|
||||
log.Error().Err(err).Msgf("could not detect gitea version, assume dev version %s", giteaDevVersion)
|
||||
client, err = gitea.NewClient(c.url, gitea.SetGiteaVersion(giteaDevVersion), gitea.SetToken(token), gitea.SetHTTPClient(httpClient), gitea.SetContext(ctx))
|
||||
|
Loading…
Reference in New Issue
Block a user