gitlab: check getFile exists before content encoding
This commit is contained in:
parent
5c4dff0fd9
commit
51a5594c89
|
@ -149,6 +149,9 @@ func (c *Client) GetUserInfo() (*gitsource.UserInfo, error) {
|
||||||
|
|
||||||
func (c *Client) GetFile(repopath, commit, file string) ([]byte, error) {
|
func (c *Client) GetFile(repopath, commit, file string) ([]byte, error) {
|
||||||
f, _, err := c.client.RepositoryFiles.GetFile(repopath, file, &gitlab.GetFileOptions{Ref: gitlab.String(commit)})
|
f, _, err := c.client.RepositoryFiles.GetFile(repopath, file, &gitlab.GetFileOptions{Ref: gitlab.String(commit)})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
data, err := base64.StdEncoding.DecodeString(f.Content)
|
data, err := base64.StdEncoding.DecodeString(f.Content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue