Escape emoji character in twemoji alt attribute

This commit is contained in:
Rūdolfs Ošiņš
2026-05-22 11:32:34 +02:00
parent 14b25872ea
commit 270117ee7d
+2 -1
View File
@@ -5,6 +5,7 @@ import type { Review } from "@bindings/cob/patch/Review";
import type { ComponentProps } from "svelte";
import bs58 from "bs58";
import escape from "lodash/escape.js";
import md5 from "md5";
import twemojiModule from "twemoji";
@@ -150,7 +151,7 @@ export function emojiToTwemoji(emoji: string, exclude?: string[]) {
if (!filename || exclude?.includes(filename)) {
return "";
}
return `<img alt="${emoji}" src="/twemoji/${filename}.svg" class="txt-emoji">`;
return `<img alt="${escape(emoji)}" src="/twemoji/${filename}.svg" class="txt-emoji">`;
}
export function scrollIntoView(id: string, options?: ScrollIntoViewOptions) {