Skip to content

Commit

Permalink
fix(server): marketplace http client bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Sep 9, 2022
1 parent 6b6b21f commit b652c80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/internal/app/config.go
Expand Up @@ -333,7 +333,7 @@ type OAuthClientCredentialsConfig struct {
}

func (c *OAuthClientCredentialsConfig) Config() *clientcredentials.Config {
if c == nil {
if c == nil || c.ClientID == "" || c.ClientSecret == "" || c.TokenURL == "" {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions server/internal/infrastructure/marketplace/marketplace.go
Expand Up @@ -36,7 +36,7 @@ func (m *Marketplace) FetchPluginPackage(ctx context.Context, pid id.PluginID) (
}

func (m *Marketplace) getPluginURL(pid id.PluginID) (string, error) {
return fmt.Sprintf("%s/api/plugins/%s/%s.zip", m.endpoint, pid.Name(), pid.Version().String()), nil
return strings.TrimSpace(fmt.Sprintf("%s/api/plugins/%s/%s.zip", m.endpoint, pid.Name(), pid.Version().String())), nil
}

/*
Expand Down Expand Up @@ -96,7 +96,7 @@ type plugin struct {

func (m *Marketplace) downloadPluginPackage(ctx context.Context, url string) (*pluginpack.Package, error) {
var client *http.Client
if m.conf != nil {
if m.conf != nil && m.conf.ClientID != "" && m.conf.ClientSecret != "" && m.conf.TokenURL != "" {
client = m.conf.Client(ctx)
}
if client == nil {
Expand Down

0 comments on commit b652c80

Please sign in to comment.