Escape special characters in long tweets

This commit is contained in:
Rewi Haar 2023-04-09 14:07:36 +12:00
parent 95893eedaa
commit fa12be41d0
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
# SPDX-License-Identifier: AGPL-3.0-only
import std/[strutils, times, macros, htmlgen, options, algorithm, re]
import std/[strutils, times, macros, htmlgen, options, algorithm, re, xmltree]
import std/unicode except strip
import packedjson
import types, utils, formatters
@ -297,7 +297,7 @@ proc expandTweetEntities*(tweet: Tweet; js: JsonNode) =
proc expandNoteTweetEntities*(tweet: Tweet; js: JsonNode) =
let
entities = ? js{"entity_set"}
text = js{"text"}.getStr
text = xmltree.escape(js{"text"}.getStr)
textSlice = 0..text.runeLen
tweet.expandTextEntities(entities, text, textSlice)