From 072109594425a7f7195111e2a3bc7987429505e0 Mon Sep 17 00:00:00 2001 From: Jofkos Date: Sun, 20 Dec 2015 18:02:54 +0100 Subject: [PATCH 1/2] Wiki pages containing question marks in their name weren't loading (untested) --- models/wiki.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/wiki.go b/models/wiki.go index 86b6c19ef..9c6292cba 100644 --- a/models/wiki.go +++ b/models/wiki.go @@ -13,6 +13,8 @@ import ( "strings" "sync" + "net/url" + "github.com/Unknwon/com" "github.com/gogits/git-module" @@ -65,12 +67,12 @@ var wikiWorkingPool = &workingPool{ // ToWikiPageURL formats a string to corresponding wiki URL name. func ToWikiPageURL(name string) string { - return strings.Replace(name, " ", "-", -1) + return url.QueryEscape(strings.Replace(name, " ", "-", -1)) } // ToWikiPageName formats a URL back to corresponding wiki page name. func ToWikiPageName(name string) string { - return strings.Replace(name, "-", " ", -1) + return url.QueryUnescape(strings.Replace(name, "-", " ", -1)) } // WikiCloneLink returns clone URLs of repository wiki. From 76d4af891f048235cab262de4e52d3989547d050 Mon Sep 17 00:00:00 2001 From: Jofkos Date: Sun, 20 Dec 2015 21:13:12 +0100 Subject: [PATCH 2/2] Removed empty line, multi return args --- models/wiki.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/wiki.go b/models/wiki.go index 9c6292cba..e3eb1f680 100644 --- a/models/wiki.go +++ b/models/wiki.go @@ -12,7 +12,6 @@ import ( "path/filepath" "strings" "sync" - "net/url" "github.com/Unknwon/com" @@ -71,8 +70,9 @@ func ToWikiPageURL(name string) string { } // ToWikiPageName formats a URL back to corresponding wiki page name. -func ToWikiPageName(name string) string { - return url.QueryUnescape(strings.Replace(name, "-", " ", -1)) +func ToWikiPageName(urlString string) string { + name, _ := url.QueryUnescape(strings.Replace(urlString, "-", " ", -1)) + return name } // WikiCloneLink returns clone URLs of repository wiki.