Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle encoding value of "none" #2924

Merged
merged 6 commits into from Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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