From 2338e301858625d9b91cea65687dea47c8edd7bc Mon Sep 17 00:00:00 2001 From: andrzejber <149780348+andrzejber@users.noreply.github.com> Date: Fri, 7 Aug 2026 22:56:11 +0200 Subject: [PATCH] Test custom emoji fallback escaping --- spec/invidious/videos/description_spec.cr | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/invidious/videos/description_spec.cr b/spec/invidious/videos/description_spec.cr index e6ca7603b..70ad65153 100644 --- a/spec/invidious/videos/description_spec.cr +++ b/spec/invidious/videos/description_spec.cr @@ -121,6 +121,25 @@ Spectator.describe "parse_description" do ) end + it "escapes an attachment fallback exactly once when its label is absent" do + description = JSON.parse(%({ + "content":"<&", + "attachmentRuns":[{ + "startIndex":0, + "length":2, + "element":{"type":{"imageType":{"image":{"sources":[{ + "url":"https://lh3.googleusercontent.com/custom=s16", + "width":16, + "height":16 + }]}}}} + }] + })) + + expect(parse_description(description, "video-id")).to eq( + %(<&) + ) + end + it "does not render zero-length graphical attachments" do description = JSON.parse(%({ "content":"plain text",