Skip to content

Commit 60e7963

Browse files
wxiaoguangsilverwindGiteaBot
authored
Fix inconsistent wiki path converting. (#24277)
The Infinite Monkey Random Typing catches a bug, inconsistent wiki path converting. Close #24276 Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 44e0cfa commit 60e7963

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

services/wiki/wiki_path.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func unescapeSegment(s string) (string, error) {
7272
}
7373

7474
func escapeSegToWeb(s string, hadDashMarker bool) string {
75-
if hadDashMarker || strings.Contains(s, "-") {
75+
if hadDashMarker || strings.Contains(s, "-") || strings.HasSuffix(s, ".md") {
7676
s = addDashMarker(s)
7777
} else {
7878
s = strings.ReplaceAll(s, " ", "-")

services/wiki/wiki_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func TestUserTitleToWebPath(t *testing.T) {
3535
}
3636
for _, test := range []test{
3737
{"wiki-name", "wiki name"},
38+
{"title.md.-", "title.md"},
3839
{"wiki-name.-", "wiki-name"},
3940
{"the+wiki-name.-", "the wiki-name"},
4041
{"a%2Fb", "a/b"},

0 commit comments

Comments
 (0)