@@ -88,17 +88,21 @@ func PrepareContextForProfileBigAvatar(ctx *context.Context) {
88
88
89
89
func FindUserProfileReadme (ctx * context.Context , doer * user_model.User ) (profileGitRepo * git.Repository , profileReadmeBlob * git.Blob , profileClose func ()) {
90
90
profileDbRepo , err := repo_model .GetRepositoryByName (ctx , ctx .ContextUser .ID , ".profile" )
91
- perm , err := access_model .GetUserRepoPermission (ctx , profileDbRepo , doer )
92
- if err == nil && ! profileDbRepo .IsEmpty && perm .CanRead (unit .TypeCode ) {
93
- if profileGitRepo , err = git .OpenRepository (ctx , profileDbRepo .RepoPath ()); err != nil {
94
- log .Error ("FindUserProfileReadme failed to OpenRepository: %v" , err )
95
- } else {
96
- if commit , err := profileGitRepo .GetBranchCommit (profileDbRepo .DefaultBranch ); err != nil {
97
- log .Error ("FindUserProfileReadme failed to GetBranchCommit: %v" , err )
91
+ if err == nil {
92
+ perm , err := access_model .GetUserRepoPermission (ctx , profileDbRepo , doer )
93
+ if err == nil && ! profileDbRepo .IsEmpty && perm .CanRead (unit .TypeCode ) {
94
+ if profileGitRepo , err = git .OpenRepository (ctx , profileDbRepo .RepoPath ()); err != nil {
95
+ log .Error ("FindUserProfileReadme failed to OpenRepository: %v" , err )
98
96
} else {
99
- profileReadmeBlob , _ = commit .GetBlobByPath ("README.md" )
97
+ if commit , err := profileGitRepo .GetBranchCommit (profileDbRepo .DefaultBranch ); err != nil {
98
+ log .Error ("FindUserProfileReadme failed to GetBranchCommit: %v" , err )
99
+ } else {
100
+ profileReadmeBlob , _ = commit .GetBlobByPath ("README.md" )
101
+ }
100
102
}
101
103
}
104
+ } else if ! repo_model .IsErrRepoNotExist (err ) {
105
+ log .Error ("FindUserProfileReadme failed to GetRepositoryByName: %v" , err )
102
106
}
103
107
return profileGitRepo , profileReadmeBlob , func () {
104
108
if profileGitRepo != nil {
0 commit comments