Commit d2ef590f authored by Sander van Harmelen's avatar Sander van Harmelen

Make sure GetRawFile returns []byte

parent 0f869110
...@@ -30,7 +30,7 @@ type ProjectSnippetsService struct { ...@@ -30,7 +30,7 @@ type ProjectSnippetsService struct {
client *Client client *Client
} }
// ListSnippetsOptions represents the available ListSnippets() options. // ListProjectSnippetsOptions represents the available ListSnippets() options.
// //
// GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html#list-snippets // GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html#list-snippets
type ListProjectSnippetsOptions struct { type ListProjectSnippetsOptions struct {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package gitlab package gitlab
import ( import (
"bytes"
"fmt" "fmt"
"net/url" "net/url"
) )
...@@ -93,7 +94,7 @@ type GetRawFileOptions struct { ...@@ -93,7 +94,7 @@ type GetRawFileOptions struct {
// //
// GitLab API docs: // GitLab API docs:
// https://docs.gitlab.com/ce/api/repository_files.html#get-raw-file-from-repository // https://docs.gitlab.com/ce/api/repository_files.html#get-raw-file-from-repository
func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, opt *GetRawFileOptions, options ...OptionFunc) (*File, *Response, error) { func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, opt *GetRawFileOptions, options ...OptionFunc) ([]byte, *Response, error) {
project, err := parseID(pid) project, err := parseID(pid)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
...@@ -105,13 +106,13 @@ func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, op ...@@ -105,13 +106,13 @@ func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, op
return nil, nil, err return nil, nil, err
} }
f := new(File) var f bytes.Buffer
resp, err := s.client.Do(req, f) resp, err := s.client.Do(req, &f)
if err != nil { if err != nil {
return nil, resp, err return nil, resp, err
} }
return f, resp, err return f.Bytes(), resp, err
} }
// FileInfo represents file details of a GitLab repository file. // FileInfo represents file details of a GitLab repository file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment