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

@ -1494,6 +1494,11 @@ defmodule HttpRequestMock do
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/twitter_card.html")}}
end
def get("https://instagram.com/longtext", _, _, _) do
{:ok,
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/instagram_longtext.html")}}
end
def get("https://example.com/non-ogp", _, _, _) do
{:ok,
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/non_ogp_embed.html")}}
@ -1720,7 +1725,8 @@ defmodule HttpRequestMock do
"https://example.com/twitter-card",
"https://google.com/",
"https://pleroma.local/notice/9kCP7V",
"https://yahoo.com/"
"https://yahoo.com/",
"https://instagram.com/longtext"
]
def head(url, _query, _body, _headers) when url in @rich_media_mocks do