add empty value checking for Bitbucket provider's setTeam and setRepository
This commit is contained in:
parent
44cdcc79c3
commit
e1984b71a2
@ -50,7 +50,7 @@ func NewBitbucketProvider(p *ProviderData) *BitbucketProvider {
|
||||
// SetTeam defines the Bitbucket team the user must be part of
|
||||
func (p *BitbucketProvider) SetTeam(team string) {
|
||||
p.Team = team
|
||||
if !strings.Contains(p.Scope, "team") {
|
||||
if team != "" && !strings.Contains(p.Scope, "team") {
|
||||
p.Scope += " team"
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ func (p *BitbucketProvider) SetTeam(team string) {
|
||||
// SetRepository defines the repository the user must have access to
|
||||
func (p *BitbucketProvider) SetRepository(repository string) {
|
||||
p.Repository = repository
|
||||
if !strings.Contains(p.Scope, "repository") {
|
||||
if repository != "" && !strings.Contains(p.Scope, "repository") {
|
||||
p.Scope += " repository"
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,8 @@ func testBitbucketProvider(hostname, team string, repository string) *BitbucketP
|
||||
ValidateURL: &url.URL{},
|
||||
Scope: ""})
|
||||
|
||||
if team != "" {
|
||||
p.SetTeam(team)
|
||||
}
|
||||
|
||||
if repository != "" {
|
||||
p.SetRepository(repository)
|
||||
}
|
||||
|
||||
if hostname != "" {
|
||||
updateURL(p.Data().LoginURL, hostname)
|
||||
|
Loading…
Reference in New Issue
Block a user