summaryrefslogtreecommitdiff
path: root/internal/text/plain_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-03-15 18:26:53 +0100
committerLibravatar GitHub <noreply@github.com>2024-03-15 17:26:53 +0000
commit0362d49da0d09784f9b974718839f5e69df3bae1 (patch)
treedfb9b03ec220c8ec4f06ea999c1093a3aa8746b3 /internal/text/plain_test.go
parent[docs] Add IPv6 example for rate limit exceptions (#2761) (diff)
downloadgotosocial-0362d49da0d09784f9b974718839f5e69df3bae1.tar.xz
[bugfix] Parse links that contain non-ascii characters (#2762)
Diffstat (limited to 'internal/text/plain_test.go')
-rw-r--r--internal/text/plain_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/text/plain_test.go b/internal/text/plain_test.go
index 43cc588c5..48280bb44 100644
--- a/internal/text/plain_test.go
+++ b/internal/text/plain_test.go
@@ -34,6 +34,8 @@ const (
withHTMLExpected = "<p>&lt;div>blah this should just be html escaped blah&lt;/div></p>"
moreComplex = "Another test @foss_satan@fossbros-anonymous.io\n\n#Hashtag\n\nText\n\n:rainbow:"
moreComplexExpected = "<p>Another test <span class=\"h-card\"><a href=\"http://fossbros-anonymous.io/@foss_satan\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>foss_satan</span></a></span><br><br><a href=\"http://localhost:8080/tags/hashtag\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>Hashtag</span></a><br><br>Text<br><br>:rainbow:</p>"
+ withUTF8Link = "here's a link with utf-8 characters in it: https://example.org/söme_url"
+ withUTF8LinkExpected = "<p>here's a link with utf-8 characters in it: <a href=\"https://example.org/s%C3%B6me_url\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">https://example.org/söme_url</a></p>"
)
type PlainTestSuite struct {
@@ -70,6 +72,11 @@ func (suite *PlainTestSuite) TestParseMoreComplex() {
suite.Equal(moreComplexExpected, formatted.HTML)
}
+func (suite *PlainTestSuite) TestWithUTF8Link() {
+ formatted := suite.FromPlain(withUTF8Link)
+ suite.Equal(withUTF8LinkExpected, formatted.HTML)
+}
+
func (suite *PlainTestSuite) TestLinkNoMention() {
statusText := `here's a link to a post by zork