fix(blogo,client): change endpoint for root directory calls
This commit is contained in:
@@ -74,9 +74,23 @@ func (c *client) GetContents(
|
|||||||
func (c *client) ListContents(
|
func (c *client) ListContents(
|
||||||
owner, repo, ref, filepath string,
|
owner, repo, ref, filepath string,
|
||||||
) ([]*contentsResponse, *http.Response, error) {
|
) ([]*contentsResponse, *http.Response, error) {
|
||||||
data, res, err := c.get(
|
endpoint := fmt.Sprintf(
|
||||||
fmt.Sprintf("/repos/%s/%s/contents/%s?ref=%s", owner, repo, filepath, url.QueryEscape(ref)),
|
"/repos/%s/%s/contents/%s?ref=%s",
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
filepath,
|
||||||
|
url.QueryEscape(ref),
|
||||||
)
|
)
|
||||||
|
if filepath == "" || filepath == "." {
|
||||||
|
endpoint = fmt.Sprintf(
|
||||||
|
"/repos/%s/%s/contents?ref=%s",
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
url.QueryEscape(ref),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
data, res, err := c.get(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []*contentsResponse{}, res, err
|
return []*contentsResponse{}, res, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user