From 73da247f83e1fba6239422e71bb873eb1d9013e1 Mon Sep 17 00:00:00 2001 From: Gus Price <42309183+GusPrice@users.noreply.github.com> Date: Mon, 18 Sep 2023 06:17:00 -0700 Subject: [PATCH] Handle encoding value of "none" (#2924) --- github/repos_contents.go | 2 ++ github/repos_contents_test.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/github/repos_contents.go b/github/repos_contents.go index de7a0d5b82..d59c735df8 100644 --- a/github/repos_contents.go +++ b/github/repos_contents.go @@ -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) } diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index ab69b5cdcb..f961306920 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -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 {