Skip to content

Commit

Permalink
config: Ensure address has trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
jsok committed Aug 10, 2019
1 parent 3d38341 commit 80595fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions path_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package artifactory
import (
"context"
"fmt"
"strings"

"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"
Expand Down Expand Up @@ -86,6 +87,9 @@ func (b *backend) pathConfigWrite(ctx context.Context, req *logical.Request, dat
if config.Address == "" {
return logical.ErrorResponse("address must be set"), nil
}
if !strings.HasSuffix(config.Address, "/") {
config.Address = config.Address + "/"
}
if config.ApiKey != "" && config.Username != "" {
return logical.ErrorResponse("provide either api_key or username, not both"), nil
}
Expand Down

0 comments on commit 80595fc

Please sign in to comment.