Skip to content

Commit

Permalink
Handle encoding value of "none" (google#2924)
Browse files Browse the repository at this point in the history
  • Loading branch information
GusPrice authored and gmlewis committed Sep 18, 2023
1 parent 70f3172 commit 73da247
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions github/repos_contents.go
Expand Up @@ -91,6 +91,8 @@ func (r *RepositoryContent) GetContent() (string, error) {
return "", nil
}
return *r.Content, nil
case "none":
return "", errors.New("unsupported content encoding: none, this may occur when file size > 1 MB, if that is the case consider using DownloadContents")
default:
return "", fmt.Errorf("unsupported content encoding: %v", encoding)
}
Expand Down
6 changes: 6 additions & 0 deletions github/repos_contents_test.go
Expand Up @@ -54,6 +54,12 @@ func TestRepositoryContent_GetContent(t *testing.T) {
want: "",
wantErr: true,
},
{
encoding: String("none"),
content: nil,
want: "",
wantErr: true,
},
}

for _, tt := range tests {
Expand Down

0 comments on commit 73da247

Please sign in to comment.