From 702dce838051be5526d9d241632a145f1cec8184 Mon Sep 17 00:00:00 2001 From: Nick Holmquist <39060876+nick-holmquist@users.noreply.github.com> Date: Tue, 7 Nov 2023 00:44:38 -0500 Subject: [PATCH] Strip trailing / from proxmox url Accidentally adding a trailing / to the proxmox_url causes issues with additional_iso_files. A 501 can be seen and the upload fails. proxmox_url ="https://my-proxmox.my-domain:8006/api2/json/" Upload request becomes; eg. POST /api2/json//nodes/pve/storage/local/upload Note the json// with the extra slash. --- builder/proxmox/common/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/proxmox/common/client.go b/builder/proxmox/common/client.go index 485e072d..2edb0539 100644 --- a/builder/proxmox/common/client.go +++ b/builder/proxmox/common/client.go @@ -6,6 +6,7 @@ package proxmox import ( "crypto/tls" "log" + "strings" "github.com/Telmate/proxmox-api-go/proxmox" ) @@ -15,7 +16,7 @@ func newProxmoxClient(config Config) (*proxmox.Client, error) { InsecureSkipVerify: config.SkipCertValidation, } - client, err := proxmox.NewClient(config.proxmoxURL.String(), nil, "", tlsConfig, "", int(config.TaskTimeout.Seconds())) + client, err := proxmox.NewClient(strings.TrimSuffix(config.proxmoxURL.String(), "/"), nil, "", tlsConfig, "", int(config.TaskTimeout.Seconds())) if err != nil { return nil, err }