@@ -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