From 7b5b739a2f9d9c84ec216ff629dbf0d1dd8a4322 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 13 Feb 2023 15:01:09 -0500 Subject: Move `IsReadmeFile*` from `modules/markup/` to `modules/util` (#22877) These functions don't examine contents, just filenames, so they don't fit in well in a markup module. This was originally part of https://github.com/go-gitea/gitea/pull/22177. Signed-off-by: Nick Guenther --- routers/web/repo/view.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'routers/web/repo/view.go') diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index ca86c744d1..8f2213a68c 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -96,7 +96,7 @@ func findReadmeFileInEntries(ctx *context.Context, entries []*git.TreeEntry) (*n } continue } - if i, ok := markup.IsReadmeFileExtension(entry.Name(), exts...); ok { + if i, ok := util.IsReadmeFileExtension(entry.Name(), exts...); ok { log.Debug("Potential readme file: %s", entry.Name()) if readmeFiles[i] == nil || base.NaturalSortLess(readmeFiles[i].name, entry.Blob().Name()) { name := entry.Name() @@ -423,7 +423,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st rd := charset.ToUTF8WithFallbackReader(io.MultiReader(bytes.NewReader(buf), dataRc)) shouldRenderSource := ctx.FormString("display") == "source" - readmeExist := markup.IsReadmeFile(blob.Name()) + readmeExist := util.IsReadmeFileName(blob.Name()) ctx.Data["ReadmeExist"] = readmeExist markupType := markup.Type(blob.Name()) -- cgit v1.2.3