mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-26 09:50:41 +00:00
Merge pull request #2257 from Jofkos/patch-1
Wiki pages containing question marks in their name weren't loading
This commit is contained in:
commit
e16042010e
1 changed files with 5 additions and 3 deletions
|
@ -12,6 +12,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
|
|
||||||
|
@ -65,12 +66,13 @@ var wikiWorkingPool = &workingPool{
|
||||||
|
|
||||||
// ToWikiPageURL formats a string to corresponding wiki URL name.
|
// ToWikiPageURL formats a string to corresponding wiki URL name.
|
||||||
func ToWikiPageURL(name string) string {
|
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.
|
// ToWikiPageName formats a URL back to corresponding wiki page name.
|
||||||
func ToWikiPageName(name string) string {
|
func ToWikiPageName(urlString string) string {
|
||||||
return strings.Replace(name, "-", " ", -1)
|
name, _ := url.QueryUnescape(strings.Replace(urlString, "-", " ", -1))
|
||||||
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
// WikiCloneLink returns clone URLs of repository wiki.
|
// WikiCloneLink returns clone URLs of repository wiki.
|
||||||
|
|
Loading…
Reference in a new issue