From 0fb52800f74e7320c3f99b2128136abab5cf28e1 Mon Sep 17 00:00:00 2001 From: mappu Date: Mon, 2 Apr 2018 18:10:51 +1200 Subject: [PATCH] bbcode: properly unhesc content before applying url escaping --- bbcode.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bbcode.go b/bbcode.go index 07d4898..afcbef9 100644 --- a/bbcode.go +++ b/bbcode.go @@ -77,7 +77,10 @@ func (this *BBCodeRenderer) bbcode(data string) string { pregReplaceRule{regexp.MustCompile(`(?si)\[\*\]`), `
  • `}, pregReplaceRule{regexp.MustCompile(`(?si)\[url=(.*?)\](.*?)\[/url\]`), `$2`}, pregReplaceFunc{regexp.MustCompile(`(?si)\[article=(.*?)\](.*?)\[/article\]`), func(m []string) string { - return `` + m[2] + `` + // m[1] has already been hesc'd + // Need to unhesc, and then pathescape + targetArticle := html.UnescapeString(m[1]) + return `` + m[2] + `` }}, pregReplaceFunc{regexp.MustCompile(`(?si)\[rev=(.*?)\](.*?)\[/rev\]`), func(m []string) string { return `` + m[2] + ``