Prevent AccountView and instance.get_or_update_favicon fails

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-09-04 07:52:22 +02:00
parent da4660d2bf
commit 0d91f65284
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE

View File

@ -145,6 +145,8 @@ defmodule Pleroma.Instances.Instance do
favicon
end
rescue
_ -> nil
end
defp scrape_favicon(%URI{} = instance_uri) do
@ -159,7 +161,8 @@ defmodule Pleroma.Instances.Instance do
|> Floki.attribute("link[rel=icon]", "href")
|> List.first(),
favicon <- URI.merge(instance_uri, favicon_rel) |> to_string(),
true <- is_binary(favicon) do
true <- is_binary(favicon),
true <- String.length(favicon) <= 255 do
favicon
else
_ -> nil