Skip to content

Commit 32e33f6

Browse files
committed
PR #3573. Fix for old approach
1 parent 44f266c commit 32e33f6

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

github/repos_contents.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo,
140140
dir := path.Dir(filepath)
141141
filename := path.Base(filepath)
142142
fileContent, _, resp, err := s.GetContents(ctx, owner, repo, filepath, opts)
143-
if err != nil {
144-
return nil, resp, err
145-
}
146143

147-
if fileContent != nil {
144+
if err == nil && fileContent != nil {
148145
content, err := fileContent.GetContent()
149146
if err == nil && content != "" {
150147
return io.NopCloser(strings.NewReader(content)), resp, nil
@@ -194,11 +191,8 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne
194191
dir := path.Dir(filepath)
195192
filename := path.Base(filepath)
196193
fileContent, _, resp, err := s.GetContents(ctx, owner, repo, filepath, opts)
197-
if err != nil {
198-
return nil, nil, resp, err
199-
}
200194

201-
if fileContent != nil {
195+
if err == nil && fileContent != nil {
202196
content, err := fileContent.GetContent()
203197
if err == nil && content != "" {
204198
return io.NopCloser(strings.NewReader(content)), fileContent, resp, nil

0 commit comments

Comments
 (0)