diff options
-rw-r--r-- | models/user.go | 2 | ||||
-rw-r--r-- | models/wiki.go | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/models/user.go b/models/user.go index 1a8500ac..f648a8ab 100644 --- a/models/user.go +++ b/models/user.go @@ -91,7 +91,7 @@ type User struct { // Counters NumFollowers int - NumFollowing int `xorm:"NOT NULL"` + NumFollowing int `xorm:"NOT NULL DEFAULT 0"` NumStars int NumRepos int 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. |