fix: url escape path components
Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
parent
3ad29588b8
commit
74054c0f71
11 changed files with 41 additions and 31 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ func createLabel(client *http.Client, repo ghrepo.Interface, opts *createOptions
|
|||
}
|
||||
|
||||
func updateLabel(apiClient *api.Client, repo ghrepo.Interface, opts *editOptions) error {
|
||||
path := fmt.Sprintf("repos/%s/%s/labels/%s", repo.RepoOwner(), repo.RepoName(), opts.Name)
|
||||
path := fmt.Sprintf("repos/%s/%s/labels/%s", repo.RepoOwner(), repo.RepoName(), url.PathEscape(opts.Name))
|
||||
properties := map[string]string{}
|
||||
if opts.Description != "" {
|
||||
properties["description"] = opts.Description
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package label
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/cli/cli/v2/api"
|
||||
"github.com/cli/cli/v2/internal/ghrepo"
|
||||
|
|
@ -94,7 +95,7 @@ func deleteRun(opts *deleteOptions) error {
|
|||
|
||||
func deleteLabel(client *http.Client, repo ghrepo.Interface, name string) error {
|
||||
apiClient := api.NewClientFromHTTP(client)
|
||||
path := fmt.Sprintf("repos/%s/%s/labels/%s", repo.RepoOwner(), repo.RepoName(), name)
|
||||
path := fmt.Sprintf("repos/%s/%s/labels/%s", repo.RepoOwner(), repo.RepoName(), url.PathEscape(name))
|
||||
|
||||
return apiClient.REST(repo.RepoHost(), "DELETE", path, nil, nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue