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)\[\*\]`), `
  • `, nil}, pregReplaceRule{regexp.MustCompile(`(?si)\[url=(.*?)\](.*?)\[/url\]`), `$2`, nil}, pregReplaceRule{regexp.MustCompile(`(?si)\[article=(.*?)\](.*?)\[/article\]`), "", func(m []string) string { - return `` + m[2] + `` + return `` + m[2] + `` }}, pregReplaceRule{regexp.MustCompile(`(?si)\[rev=(.*?)\](.*?)\[/rev\]`), "", func(m []string) string { - return `` + m[2] + `` + return `` + m[2] + `` }}, pregReplaceRule{regexp.MustCompile(`(?si)\[imgur\](.*?)\.(...)\[/imgur\]`), diff --git a/pageTemplate.go b/pageTemplate.go index c5c168b..32791f1 100644 --- a/pageTemplate.go +++ b/pageTemplate.go @@ -85,13 +85,13 @@ function els(e,s){ // no js exec in innerHTML
    -
    +
    -
    +
    {{if .CurrentPageIsArticle }}
    -
    -
    +
    +
    {{end}}