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:
parent
771c3dc126
commit
01dbc7cee4
1 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue