Merge remote-tracking branch 'remotes/origin/develop' into media-preview-proxy
authorIvan Tashkinov <ivantashkinov@gmail.com>
Fri, 11 Sep 2020 14:19:58 +0000 (17:19 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Fri, 11 Sep 2020 14:19:58 +0000 (17:19 +0300)
# Conflicts:
# lib/pleroma/instances/instance.ex

1  2 
config/config.exs
config/description.exs
lib/pleroma/instances/instance.ex
lib/pleroma/web/mastodon_api/views/status_view.ex

Simple merge
Simple merge
index ad7764f05b54145ee912d5dd6124513e12cb14b6,6948651c7bacdbba4768fe8df50a68904a5eeae5..f0f6014690a090b1d97e04f7a47aa4a3b2fe641d
@@@ -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