1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-09 19:18:20 +00:00

Fix #8582 by handling empty repos (#8587) (#8593)

* Fix #8582 by handling empty repos

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix tests

Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
6543
2019-10-19 21:07:12 +02:00
committed by Lauris BH
parent d4501ece55
commit 519f69eb41
2 changed files with 19 additions and 0 deletions

View File

@@ -38,6 +38,9 @@ func (ct *ContentType) String() string {
// GetContentsOrList gets the meta data of a file's contents (*ContentsResponse) if treePath not a tree
// directory, otherwise a listing of file contents ([]*ContentsResponse). Ref can be a branch, commit or tag
func GetContentsOrList(repo *models.Repository, treePath, ref string) (interface{}, error) {
if repo.IsEmpty {
return make([]interface{}, 0), nil
}
if ref == "" {
ref = repo.DefaultBranch
}