Redirects for videos right now
authorMark Felder <feld@FreeBSD.org>
Tue, 25 Aug 2020 22:31:55 +0000 (17:31 -0500)
committerMark Felder <feld@FreeBSD.org>
Tue, 25 Aug 2020 22:31:55 +0000 (17:31 -0500)
lib/pleroma/web/media_proxy/media_proxy_controller.ex

index b925973ba6cf587683a781da759b2c93397e4d20..6abbf9e238007dee46ac46eb90eff06923910ca4 100644 (file)
@@ -69,6 +69,12 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
     handle_image_preview(conn, url)
   end
 
+  defp handle_preview("video/" <> _ = _content_type, conn, url) do
+    mediaproxy_url = url |> MediaProxy.url()
+
+    redirect(conn, external: mediaproxy_url)
+  end
+
   defp handle_preview(content_type, conn, _url) do
     send_resp(conn, :unprocessable_entity, "Unsupported content type: #{content_type}.")
   end