Follow redirects.
authorMark Felder <feld@FreeBSD.org>
Thu, 27 Aug 2020 16:46:56 +0000 (11:46 -0500)
committerMark Felder <feld@FreeBSD.org>
Thu, 27 Aug 2020 16:46:56 +0000 (11:46 -0500)
I think we should be using some global adapter options here, though.

lib/pleroma/web/media_proxy/media_proxy_controller.ex

index d465ce8d10e530b036bbf789e986ffdc3bf7bcab..736b7db56364fd68246e52aea1ac1111bea0913b 100644 (file)
@@ -50,7 +50,9 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
 
   defp handle_preview(conn, url) do
     with {:ok, %{status: status} = head_response} when status in 200..299 <-
-           Tesla.head(url, opts: [adapter: [timeout: preview_head_request_timeout()]]) do
+           Tesla.head(url,
+             opts: [adapter: [timeout: preview_head_request_timeout(), follow_redirect: true]]
+           ) do
       content_type = Tesla.get_header(head_response, "content-type")
       handle_preview(content_type, conn, url)
     else