diff options
author | Unknwon <u@gogs.io> | 2017-02-15 18:18:33 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-02-15 18:18:33 -0500 |
commit | c2277796e4dc811db7f5c2555b2b5e1eb4a2c430 (patch) | |
tree | d1a9d89d162457341e4aa689f662bc944f8625a5 /models | |
parent | f97b250509f579f62e2ce846adb89a400da88f8f (diff) |
wiki: remove redundant string replace (#3754)
Diffstat (limited to 'models')
-rw-r--r-- | models/wiki.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/wiki.go b/models/wiki.go index 7547d552..4f754f80 100644 --- a/models/wiki.go +++ b/models/wiki.go @@ -25,14 +25,14 @@ var wikiWorkingPool = sync.NewExclusivePool() // ToWikiPageURL formats a string to corresponding wiki URL name. func ToWikiPageURL(name string) string { - return url.QueryEscape(strings.Replace(name, " ", "-", -1)) + return url.QueryEscape(name) } // ToWikiPageName formats a URL back to corresponding wiki page name, // and removes leading characters './' to prevent changing files // that are not belong to wiki repository. func ToWikiPageName(urlString string) string { - name, _ := url.QueryUnescape(strings.Replace(urlString, "-", " ", -1)) + name, _ := url.QueryUnescape(urlString) return strings.Replace(strings.TrimLeft(name, "./"), "/", " ", -1) } |