diff --git a/lib/zoeyscomputer_web/router.ex b/lib/zoeyscomputer_web/router.ex index 853db28..4517f30 100644 --- a/lib/zoeyscomputer_web/router.ex +++ b/lib/zoeyscomputer_web/router.ex @@ -147,22 +147,13 @@ defmodule ZoeyscomputerWeb.Router do if is_discord do # Extract the ID from the path id = List.last(conn.path_info) + url = "https://s3.zoeys.computer/imgs/uploads/#{id}.png" - case download_from_s3("imgs", "uploads/#{id}.png") do - {:ok, image_binary, content_type} -> - conn - |> put_resp_content_type(content_type) - |> send_resp(200, image_binary) - |> halt() - - {:error, reason} -> - IO.puts(reason) - - conn - |> put_resp_content_type("text/plain") - |> send_resp(500, "failed to retrieve image") - |> halt() - end + conn + |> put_resp_header("location", url) + |> put_resp_content_type("text/plain") + |> send_resp(302, "Redirecting to image") + |> halt() else conn end