fix not obtaining correct gitlab url because of empty string (#2044)

This commit is contained in:
contrun 2021-04-01 01:21:16 +08:00 committed by GitHub
parent d7ab817de7
commit c96ff595e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,11 @@ func GetProvider(options Options) (provider Provider) {
globalProvider.options = options
}()
providerURL, _ := url.Parse(options.ProviderURL)
var providerURL *url.URL
// url.Parse will succeed even if we pass an empty string
if options.ProviderURL != "" {
providerURL, _ = url.Parse(options.ProviderURL)
}
switch options.Provider {
case auth0.Name:
serviceAccount, err := auth0.ParseServiceAccount(options)