Update gitea go-sdk to v0.15.0 (#385)
Update "code.gitea.io/sdk/gitea" to latest release Reviewed-on: https://gitea.com/gitea/tea/pulls/385 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-committed-by: 6543 <6543@obermui.de>
This commit is contained in:
22
vendor/code.gitea.io/sdk/gitea/client.go
generated
vendored
22
vendor/code.gitea.io/sdk/gitea/client.go
generated
vendored
@@ -13,6 +13,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -309,3 +310,24 @@ func (c *Client) getStatusCode(method, path string, header http.Header, body io.
|
||||
|
||||
return resp.StatusCode, resp, nil
|
||||
}
|
||||
|
||||
// pathEscapeSegments escapes segments of a path while not escaping forward slash
|
||||
func pathEscapeSegments(path string) string {
|
||||
slice := strings.Split(path, "/")
|
||||
for index := range slice {
|
||||
slice[index] = url.PathEscape(slice[index])
|
||||
}
|
||||
escapedPath := strings.Join(slice, "/")
|
||||
return escapedPath
|
||||
}
|
||||
|
||||
// escapeValidatePathSegments is a help function to validate and encode url path segments
|
||||
func escapeValidatePathSegments(seg ...*string) error {
|
||||
for i := range seg {
|
||||
if seg[i] == nil || len(*seg[i]) == 0 {
|
||||
return fmt.Errorf("path segment [%d] is empty", i)
|
||||
}
|
||||
*seg[i] = url.PathEscape(*seg[i])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user