aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/view.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-05-02 16:57:54 +0800
committerBo-Yi Wu <appleboy.tw@gmail.com>2017-05-02 16:57:54 +0800
commit0d1e001b9cae08c2d5f0ffc0ef9fec0f92d1683e (patch)
tree7859dedd67c1848060c03ef3fdbdcdb76aa2070b /routers/repo/view.go
parent98548c83d369a15f10dcd01656474c8dad98ba6a (diff)
downloadgitea-0d1e001b9cae08c2d5f0ffc0ef9fec0f92d1683e.tar.gz
gitea-0d1e001b9cae08c2d5f0ffc0ef9fec0f92d1683e.zip
fix multiple readme file rendering and fix #1657 (#1658)
* fix multiple readme file rendering and fix #1657 * remove unnecessary loop
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r--routers/repo/view.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 2e4b2644cd..165284a599 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -56,13 +56,19 @@ func renderDirectory(ctx *context.Context, treeLink string) {
var readmeFile *git.Blob
for _, entry := range entries {
- if entry.IsDir() || !markup.IsReadmeFile(entry.Name()) {
+ if entry.IsDir() {
+ continue
+ }
+
+ tp, ok := markup.ReadmeFileType(entry.Name())
+ if !ok {
continue
}
- // TODO: collect all possible README files and show with priority.
readmeFile = entry.Blob()
- break
+ if tp != "" {
+ break
+ }
}
if readmeFile != nil {