From ce190d867ca126001a1c0417b00810fc03c0b3ba Mon Sep 17 00:00:00 2001
From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>
Date: Mon, 16 Aug 2021 19:17:56 +0200
Subject: Text/status parsing fixes (#141)
* aaaaaa
* vendor minify
* update + test markdown parsing
---
internal/text/plain.go | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'internal/text/plain.go')
diff --git a/internal/text/plain.go b/internal/text/plain.go
index 40fb6412f..a44e02c80 100644
--- a/internal/text/plain.go
+++ b/internal/text/plain.go
@@ -19,6 +19,7 @@
package text
import (
+ "fmt"
"strings"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@@ -27,6 +28,9 @@ import (
func (f *formatter) FromPlain(plain string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string {
content := preformat(plain)
+ // sanitize any html elements
+ content = RemoveHTML(content)
+
// format links nicely
content = f.ReplaceLinks(content)
@@ -39,5 +43,8 @@ func (f *formatter) FromPlain(plain string, mentions []*gtsmodel.Mention, tags [
// replace newlines with breaks
content = strings.ReplaceAll(content, "\n", "
")
+ // wrap the whole thing in a pee
+ content = fmt.Sprintf(`
%s
`, content) + return postformat(content) } -- cgit v1.2.3