瀏覽代碼

[api] Deep forking should be possible

With forks deeper then 1 (meaning forks of forks) the api breaks as it will
recursively ask for parents which in turn have not been fetched from the db.

Limiting the depth of the parent retrieval works around this.
cgars 7 年之前
父節點
當前提交
33c3b62c3f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      models/repo.go

+ 1 - 1
models/repo.go

@@ -311,7 +311,7 @@ func (repo *Repository) APIFormat(permission *api.Permission) *api.Repository {
 		Updated:       repo.Updated,
 		Permissions:   permission,
 	}
-	if repo.IsFork {
+	if repo.IsFork && repo.BaseRepo != nil {
 		// FIXME: check precise permission for base repository
 		apiRepo.Parent = repo.BaseRepo.APIFormat(nil)
 	}