diff --git a/spec/invidious/videos/description_spec.cr b/spec/invidious/videos/description_spec.cr index 054e5ca66..e6ca7603b 100644 --- a/spec/invidious/videos/description_spec.cr +++ b/spec/invidious/videos/description_spec.cr @@ -83,6 +83,24 @@ Spectator.describe "parse_description" do expect(parse_description(description, "video-id")).to eq("before <:custom:> after") end + it "preserves the escaped shortcode when an attachment source URL is invalid" do + description = JSON.parse(%({ + "content":"before <:custom:> after", + "attachmentRuns":[{ + "startIndex":8, + "length":8, + "element":{"type":{"imageType":{"image":{"sources":[{ + "url":"https://lh3.googleusercontent.com:invalid/custom.png", + "width":16, + "height":16 + }]}}}}, + "properties":{"accessibilityProperties":{"label":"custom"}} + }] + })) + + expect(parse_description(description, "video-id")).to eq("before <:custom:> after") + end + it "escapes attachment labels before inserting them into HTML" do description = JSON.parse(%({ "content":":custom:",