From 80595fc741bb3d689b972bfbdf5a96f5f0983c96 Mon Sep 17 00:00:00 2001 From: Jonathan Sokolowski Date: Sat, 10 Aug 2019 15:05:25 +1000 Subject: [PATCH] config: Ensure address has trailing slash --- path_config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/path_config.go b/path_config.go index c9e7d5f..c19f0f9 100644 --- a/path_config.go +++ b/path_config.go @@ -3,6 +3,7 @@ package artifactory import ( "context" "fmt" + "strings" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" @@ -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 }