fix: use better `]]>` replacer

This commit is contained in:
Lhcfl 2024-04-14 16:44:12 +08:00
parent 54d9916fec
commit 241c824ab5
1 changed files with 1 additions and 4 deletions

View File

@ -8,12 +8,9 @@ import getNoteHtml from "@/remote/activitypub/misc/get-note-html.js";
/**
* If there is this part in the note, it will cause CDATA to be terminated early.
* So I inserted two zero-width spaces in the middle, which doesn't make a visual difference
* Although this is not a good solution, there seems no other way.
* Anyway, it is not common to encounter such extreme situations.
*/
function escapeCDATA(str: string) {
return str.replaceAll("]]>", "]]>");
return str.replaceAll("]]>", "]]]]><![CDATA[>");
}
export default async function (