Skip to content

Unable to create empty file #2427

@Ashvin-Ranjan

Description

@Ashvin-Ranjan

When attempting to commit an empty file to a repository using ghClient.Repositories.CreateFile and passing in []byte{} under the Content field of a github.RepositoryContentFileOptions the GitHub API will return a 422 error stating that content was not supplied. This is most likely due to the line:

Content []byte `json:"content,omitempty"` // unencoded

Which adds omitempty to the Content field of github.RepositoryContentFileOptions, even though it is a necessary field of the request.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions