bbcode: properly unhesc content before applying url escaping
This commit is contained in:
parent
b080a6f017
commit
0fb52800f7
@ -77,7 +77,10 @@ func (this *BBCodeRenderer) bbcode(data string) string {
|
||||
pregReplaceRule{regexp.MustCompile(`(?si)\[\*\]`), `</li><li>`},
|
||||
pregReplaceRule{regexp.MustCompile(`(?si)\[url=(.*?)\](.*?)\[/url\]`), `<a rel="noreferrer" href="$1">$2</a>`},
|
||||
pregReplaceFunc{regexp.MustCompile(`(?si)\[article=(.*?)\](.*?)\[/article\]`), func(m []string) string {
|
||||
return `<a href="` + template.HTMLEscapeString(this.baseUrl+`view/`+url.PathEscape(m[1])) + `">` + m[2] + `</a>`
|
||||
// m[1] has already been hesc'd
|
||||
// Need to unhesc, and then pathescape
|
||||
targetArticle := html.UnescapeString(m[1])
|
||||
return `<a href="` + template.HTMLEscapeString(this.baseUrl+`view/`+url.PathEscape(targetArticle)) + `">` + m[2] + `</a>`
|
||||
}},
|
||||
pregReplaceFunc{regexp.MustCompile(`(?si)\[rev=(.*?)\](.*?)\[/rev\]`), func(m []string) string {
|
||||
return `<a href="` + template.HTMLEscapeString(this.baseUrl+`archive/`+url.PathEscape(m[1])) + `">` + m[2] + `</a>`
|
||||
|
Loading…
Reference in New Issue
Block a user