diff options
author | katsu <evergonuaa@gmail.com> | 2023-12-27 16:32:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 08:32:27 +0000 |
commit | 42149ff1a816501643ec2407ed61a83bf5b65059 (patch) | |
tree | 410cb4affcbca99862046061225d750ec7f881f3 /routers/web/shared | |
parent | baf0d402d9cb47849394202fcfc7c2e23b0faac3 (diff) | |
download | gitea-42149ff1a816501643ec2407ed61a83bf5b65059.tar.gz gitea-42149ff1a816501643ec2407ed61a83bf5b65059.zip |
fix wrong link in user and organization profile when using relative url (#28617)
fix #28436.
the doc https://docs.gitea.com/usage/profile-readme maybe also need to
be updated to tell that
the main branch is necessary,which means the following three conditions
should be satisfied:
- repo: **.profile**
- branch: **[default branch]**
- markdown: **README.md**
Diffstat (limited to 'routers/web/shared')
-rw-r--r-- | routers/web/shared/user/header.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/web/shared/user/header.go b/routers/web/shared/user/header.go index 411d499eb4..919a080b42 100644 --- a/routers/web/shared/user/header.go +++ b/routers/web/shared/user/header.go @@ -87,7 +87,7 @@ func PrepareContextForProfileBigAvatar(ctx *context.Context) { } } -func FindUserProfileReadme(ctx *context.Context, doer *user_model.User) (profileGitRepo *git.Repository, profileReadmeBlob *git.Blob, profileClose func()) { +func FindUserProfileReadme(ctx *context.Context, doer *user_model.User) (profileDbRepo *repo_model.Repository, profileGitRepo *git.Repository, profileReadmeBlob *git.Blob, profileClose func()) { profileDbRepo, err := repo_model.GetRepositoryByName(ctx, ctx.ContextUser.ID, ".profile") if err == nil { perm, err := access_model.GetUserRepoPermission(ctx, profileDbRepo, doer) @@ -105,7 +105,7 @@ func FindUserProfileReadme(ctx *context.Context, doer *user_model.User) (profile } else if !repo_model.IsErrRepoNotExist(err) { log.Error("FindUserProfileReadme failed to GetRepositoryByName: %v", err) } - return profileGitRepo, profileReadmeBlob, func() { + return profileDbRepo, profileGitRepo, profileReadmeBlob, func() { if profileGitRepo != nil { _ = profileGitRepo.Close() } @@ -115,7 +115,7 @@ func FindUserProfileReadme(ctx *context.Context, doer *user_model.User) (profile func RenderUserHeader(ctx *context.Context) { prepareContextForCommonProfile(ctx) - _, profileReadmeBlob, profileClose := FindUserProfileReadme(ctx, ctx.Doer) + _, _, profileReadmeBlob, profileClose := FindUserProfileReadme(ctx, ctx.Doer) defer profileClose() ctx.Data["HasProfileReadme"] = profileReadmeBlob != nil } |