diff --git a/modules/markup/markup.go b/modules/markup/markup.go index dc27997e8d0..e1fae3a5a89 100644 --- a/modules/markup/markup.go +++ b/modules/markup/markup.go @@ -71,11 +71,14 @@ func ReadmeFileType(name string) (string, bool) { // IsReadmeFile reports whether name looks like a README file // based on its name. func IsReadmeFile(name string) bool { - name = strings.ToLower(name) if len(name) < 6 { return false - } else if len(name) == 6 { + } + + name = strings.ToLower(name) + if len(name) == 6 { return name == "readme" } return name[:7] == "readme." } + diff --git a/modules/markup/markup_test.go b/modules/markup/markup_test.go index 92caa8ff966..0dd2be3564c 100644 --- a/modules/markup/markup_test.go +++ b/modules/markup/markup_test.go @@ -25,6 +25,7 @@ func TestMisc_IsReadmeFile(t *testing.T) { "abcdefg", "abcdefghijklmnopqrstuvwxyz", "test.md.test", + "readmf", } for _, testCase := range trueTestCases {