Prevent AccountView and instance.get_or_update_favicon fails
This commit is contained in:
parent
da4660d2bf
commit
0d91f65284
@ -145,6 +145,8 @@ def get_or_update_favicon(%URI{host: host} = instance_uri) do
|
|||||||
|
|
||||||
favicon
|
favicon
|
||||||
end
|
end
|
||||||
|
rescue
|
||||||
|
_ -> nil
|
||||||
end
|
end
|
||||||
|
|
||||||
defp scrape_favicon(%URI{} = instance_uri) do
|
defp scrape_favicon(%URI{} = instance_uri) do
|
||||||
@ -159,7 +161,8 @@ defp scrape_favicon(%URI{} = instance_uri) do
|
|||||||
|> Floki.attribute("link[rel=icon]", "href")
|
|> Floki.attribute("link[rel=icon]", "href")
|
||||||
|> List.first(),
|
|> List.first(),
|
||||||
favicon <- URI.merge(instance_uri, favicon_rel) |> to_string(),
|
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
|
favicon
|
||||||
else
|
else
|
||||||
_ -> nil
|
_ -> nil
|
||||||
|
Loading…
Reference in New Issue
Block a user