Truncate the length of Rich Media title and description fields

Some sites like Instagram are serving obnoxiously long metadata fields
This commit is contained in:
Mark Felder 2025-03-19 10:29:45 -07:00
commit 7763b9a87f
5 changed files with 118 additions and 1 deletions

View file

@ -61,6 +61,13 @@ defmodule Pleroma.Web.RichMedia.ParserTest do
}}
end
test "truncates title and description fields" do
{:ok, parsed} = Parser.parse("https://instagram.com/longtext")
assert String.length(parsed["title"]) == 120
assert String.length(parsed["description"]) == 200
end
test "parses OEmbed and filters HTML tags" do
assert Parser.parse("https://example.com/oembed") ==
{:ok,