diff options
author | Michael Muré <batolettre@gmail.com> | 2021-04-19 12:55:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 12:55:22 +0200 |
commit | c2a30a35fb24f1c4760ae9d2e9b25d444c2db060 (patch) | |
tree | 2e44d363785661d68a4e237865d11a1fa14687bf | |
parent | 24155156223595e48f215e87cf9ce7895e22f4a7 (diff) | |
parent | a80152890cd3db27c25717fdc45ae19b5b2d5b8c (diff) | |
download | git-bug-c2a30a35fb24f1c4760ae9d2e9b25d444c2db060.tar.gz |
Merge pull request #636 from ellsclytn/fix/new-gh-token-format
Support new GitHub token formats
-rw-r--r-- | bridge/github/config.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bridge/github/config.go b/bridge/github/config.go index 1e23c8ee..55a09c53 100644 --- a/bridge/github/config.go +++ b/bridge/github/config.go @@ -365,12 +365,13 @@ func promptToken() (*auth.Token, error) { fmt.Println(" - 'repo' : to be able to read private repositories") fmt.Println() - re := regexp.MustCompile(`^[a-zA-Z0-9]{40}$`) + legacyRe := regexp.MustCompile(`^[a-zA-Z0-9]{40}$`) + re := regexp.MustCompile(`^(?:ghp|gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36,255}$`) var login string validator := func(name string, value string) (complaint string, err error) { - if !re.MatchString(value) { + if !re.MatchString(value) && !legacyRe.MatchString(value) { return "token has incorrect format", nil } login, err = getLoginFromToken(auth.NewToken(target, value)) |