forked from AkkomaGang/akkoma
Follow redirects.
I think we should be using some global adapter options here, though.
This commit is contained in:
parent
697bea0473
commit
157ecf4022
1 changed files with 3 additions and 1 deletions
|
@ -50,7 +50,9 @@ def preview(conn, %{"sig" => sig64, "url" => url64}) do
|
||||||
|
|
||||||
defp handle_preview(conn, url) do
|
defp handle_preview(conn, url) do
|
||||||
with {:ok, %{status: status} = head_response} when status in 200..299 <-
|
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")
|
content_type = Tesla.get_header(head_response, "content-type")
|
||||||
handle_preview(content_type, conn, url)
|
handle_preview(content_type, conn, url)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue