From bdde56c95c338822f84857f9a0a20a73eb62ce6d Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 17 Jun 2022 13:48:10 +0800 Subject: [PATCH] Fix Readme render bug (#19992) Fix #19988 Co-authored-by: zeripath --- routers/web/repo/view.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index fe60cf44c..c327f959f 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -357,7 +357,7 @@ func renderReadmeFile(ctx *context.Context, readmeFile *namedBlob, readmeTreelin var result strings.Builder err := markup.Render(&markup.RenderContext{ Ctx: ctx, - RelativePath: ctx.Repo.TreePath, + RelativePath: path.Join(ctx.Repo.TreePath, readmeFile.name), // ctx.Repo.TreePath is the directory not the Readme so we must append the Readme filename (and path). URLPrefix: readmeTreelink, Metas: ctx.Repo.Repository.ComposeDocumentMetas(), GitRepo: ctx.Repo.GitRepo,