fix: url escape path components

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2026-04-22 15:55:02 +01:00
parent 3ad29588b8
commit 74054c0f71
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E
11 changed files with 41 additions and 31 deletions

View file

@ -3,6 +3,7 @@ package list
import (
"fmt"
"net/http"
"net/url"
"slices"
"strings"
"time"
@ -197,12 +198,12 @@ func getRepoVariables(client *http.Client, repo ghrepo.Interface) ([]shared.Vari
}
func getEnvVariables(client *http.Client, repo ghrepo.Interface, envName string) ([]shared.Variable, error) {
path := fmt.Sprintf("repos/%s/environments/%s/variables", ghrepo.FullName(repo), envName)
path := fmt.Sprintf("repos/%s/environments/%s/variables", ghrepo.FullName(repo), url.PathEscape(envName))
return getVariables(client, repo.RepoHost(), path)
}
func getOrgVariables(client *http.Client, host, orgName string, showSelectedRepoInfo bool) ([]shared.Variable, error) {
variables, err := getVariables(client, host, fmt.Sprintf("orgs/%s/actions/variables", orgName))
variables, err := getVariables(client, host, fmt.Sprintf("orgs/%s/actions/variables", url.PathEscape(orgName)))
if err != nil {
return nil, err
}