diff options
author | Unknwon <u@gogs.io> | 2015-12-24 10:00:03 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-24 10:00:03 -0500 |
commit | e16042010e102eb135c3b5ed2014c1d99e6412cf (patch) | |
tree | d84886689716d72e33e440cbf6028e43f8af6be3 /models | |
parent | a49af93fafe824cdd375318d15de420b3ed61e79 (diff) | |
parent | 76d4af891f048235cab262de4e52d3989547d050 (diff) |
Merge pull request #2257 from Jofkos/patch-1
Wiki pages containing question marks in their name weren't loading
Diffstat (limited to 'models')
-rw-r--r-- | models/wiki.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/models/wiki.go b/models/wiki.go index 86b6c19e..e3eb1f68 100644 --- a/models/wiki.go +++ b/models/wiki.go @@ -12,6 +12,7 @@ import ( "path/filepath" "strings" "sync" + "net/url" "github.com/Unknwon/com" @@ -65,12 +66,13 @@ 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) +func ToWikiPageName(urlString string) string { + name, _ := url.QueryUnescape(strings.Replace(urlString, "-", " ", -1)) + return name } // WikiCloneLink returns clone URLs of repository wiki. |