Skip to content

Commit

Permalink
Merge pull request #2 from Dalee/v4-archive-param-name
Browse files Browse the repository at this point in the history
dirty tricks of v4 API
  • Loading branch information
arkady-emelyanov authored May 17, 2017
2 parents 72cfa55 + 8fa13f6 commit acb83d7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/client/gitlab/client_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,17 @@ func (c *Client) GetTagList(project *Project) ([]*Tag, error) {
//
//
func (c *Client) GetArchive(project *Project, ref string) ([]byte, error) {
// v4 uses sha as parameter name
// v3 uses ref as parameter name
refParam := "ref"
if c.HasV4Support {
refParam = "sha"
}

endpoint := fmt.Sprintf(
"projects/%d/repository/archive.tar.gz?ref=%s",
"projects/%d/repository/archive.tar.gz?%s=%s",
project.ID,
refParam,
url.QueryEscape(ref),
)

Expand Down

0 comments on commit acb83d7

Please sign in to comment.