Strip trailing slash from PVE host URLs

A trailing slash in --pve.host (e.g. https://host:8006/) caused API
requests to fail with status 500 due to double slashes in the path.
This commit is contained in:
Davíð Steinn Geirsson 2026-03-23 11:34:16 +00:00
parent 771c3dc126
commit 01dbc7cee4

View file

@ -41,6 +41,11 @@ func NewClient(hosts []string, token string, tlsInsecure bool, maxConcurrent int
TLSHandshakeTimeout: 5 * time.Second,
}
// Normalize hosts: strip trailing slashes
for i, h := range hosts {
hosts[i] = strings.TrimRight(h, "/")
}
// Normalize token: ensure it has the PVEAPIToken= prefix
if !strings.HasPrefix(token, "PVEAPIToken=") {
token = "PVEAPIToken=" + token