mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	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>
This commit is contained in:
		@@ -72,7 +72,7 @@ func unescapeSegment(s string) (string, error) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func escapeSegToWeb(s string, hadDashMarker bool) string {
 | 
					func escapeSegToWeb(s string, hadDashMarker bool) string {
 | 
				
			||||||
	if hadDashMarker || strings.Contains(s, "-") {
 | 
						if hadDashMarker || strings.Contains(s, "-") || strings.HasSuffix(s, ".md") {
 | 
				
			||||||
		s = addDashMarker(s)
 | 
							s = addDashMarker(s)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		s = strings.ReplaceAll(s, " ", "-")
 | 
							s = strings.ReplaceAll(s, " ", "-")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,6 +35,7 @@ func TestUserTitleToWebPath(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	for _, test := range []test{
 | 
						for _, test := range []test{
 | 
				
			||||||
		{"wiki-name", "wiki name"},
 | 
							{"wiki-name", "wiki name"},
 | 
				
			||||||
 | 
							{"title.md.-", "title.md"},
 | 
				
			||||||
		{"wiki-name.-", "wiki-name"},
 | 
							{"wiki-name.-", "wiki-name"},
 | 
				
			||||||
		{"the+wiki-name.-", "the wiki-name"},
 | 
							{"the+wiki-name.-", "the wiki-name"},
 | 
				
			||||||
		{"a%2Fb", "a/b"},
 | 
							{"a%2Fb", "a/b"},
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user