diff options
Diffstat (limited to 'models/repo_permission.go')
-rw-r--r-- | models/repo_permission.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/models/repo_permission.go b/models/repo_permission.go index 374c6f8d56..cd20224912 100644 --- a/models/repo_permission.go +++ b/models/repo_permission.go @@ -164,10 +164,6 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss return } - if repo.Owner == nil { - repo.mustOwner(e) - } - var isCollaborator bool if user != nil { isCollaborator, err = repo.isCollaborator(e, user.ID) @@ -176,6 +172,10 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss } } + if err = repo.getOwner(e); err != nil { + return + } + // Prevent strangers from checking out public repo of private orginization // Allow user if they are collaborator of a repo within a private orginization but not a member of the orginization itself if repo.Owner.IsOrganization() && !HasOrgVisible(repo.Owner, user) && !isCollaborator { |