diff --git a/services/wiki/wiki_path.go b/services/wiki/wiki_path.go index 45c6a5a84e..f2600ad8ba 100644 --- a/services/wiki/wiki_path.go +++ b/services/wiki/wiki_path.go @@ -72,7 +72,7 @@ func unescapeSegment(s string) (string, error) { } func escapeSegToWeb(s string, hadDashMarker bool) string { - if hadDashMarker || strings.Contains(s, "-") { + if hadDashMarker || strings.Contains(s, "-") || strings.HasSuffix(s, ".md") { s = addDashMarker(s) } else { s = strings.ReplaceAll(s, " ", "-") diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index 716ea6104a..a781ebeda4 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -35,6 +35,7 @@ func TestUserTitleToWebPath(t *testing.T) { } for _, test := range []test{ {"wiki-name", "wiki name"}, + {"title.md.-", "title.md"}, {"wiki-name.-", "wiki-name"}, {"the+wiki-name.-", "the wiki-name"}, {"a%2Fb", "a/b"},