From: Ivan Tashkinov Date: Fri, 11 Sep 2020 14:19:58 +0000 (+0300) Subject: Merge remote-tracking branch 'remotes/origin/develop' into media-preview-proxy X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=0bda85857e8f320ee7b91d8203fd621e1e2d5180;p=akkoma Merge remote-tracking branch 'remotes/origin/develop' into media-preview-proxy # Conflicts: # lib/pleroma/instances/instance.ex --- 0bda85857e8f320ee7b91d8203fd621e1e2d5180 diff --cc lib/pleroma/instances/instance.ex index ad7764f05,6948651c7..f0f601469 --- a/lib/pleroma/instances/instance.ex +++ b/lib/pleroma/instances/instance.ex @@@ -156,14 -156,14 +156,12 @@@ defmodule Pleroma.Instances.Instance d defp scrape_favicon(%URI{} = instance_uri) do try do with {:ok, %Tesla.Env{body: html}} <- - Pleroma.HTTP.get(to_string(instance_uri), [{"accept", "text/html"}], - adapter: [pool: :media] - ), + Pleroma.HTTP.get(to_string(instance_uri), [{"accept", "text/html"}], pool: :media), - favicon_rel <- - html - |> Floki.parse_document!() - |> Floki.attribute("link[rel=icon]", "href") - |> List.first(), - favicon <- URI.merge(instance_uri, favicon_rel) |> to_string(), - true <- is_binary(favicon) do + {_, [favicon_rel | _]} when is_binary(favicon_rel) <- + {:parse, + html |> Floki.parse_document!() |> Floki.attribute("link[rel=icon]", "href")}, + {_, favicon} when is_binary(favicon) <- + {:merge, URI.merge(instance_uri, favicon_rel) |> to_string()} do favicon else _ -> nil