diff --git a/WikiServer.go b/WikiServer.go index 645b7d8..49f6a0d 100644 --- a/WikiServer.go +++ b/WikiServer.go @@ -83,7 +83,12 @@ func (this *WikiServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } else if strings.HasPrefix(r.URL.Path, this.opts.ExpectBaseURL+"view/") { - articleTitle := r.URL.Path[len(this.opts.ExpectBaseURL+"view/"):] + articleTitle, err := url.QueryUnescape(r.URL.Path[len(this.opts.ExpectBaseURL+"view/"):]) + if err != nil { + this.serveErrorMessage(w, err) + return + } + a, err := this.db.GetLatestVersion(articleTitle) if err != nil { this.serveErrorMessage(w, err) diff --git a/bbcode.go b/bbcode.go index 807e13d..31c20e7 100644 --- a/bbcode.go +++ b/bbcode.go @@ -3,6 +3,7 @@ package yatwiki3 import ( "encoding/json" "html/template" + "net/url" "regexp" "strings" ) @@ -44,10 +45,10 @@ func (this *BBCodeRenderer) bbcode(data string) string { pregReplaceRule{regexp.MustCompile(`(?si)\[\*\]`), `