mediaproxy: proxy network-path references

Discovered-by: snow
Fixes: https://akkoma.dev/AkkomaGang/akkoma/issues/900
(cherry picked from commit bbf974adc82d09a2099fb1234729131929307911)
This commit is contained in:
Oneric 2025-04-14 00:26:10 +02:00 • committed by Lain Soykaf
commit 5cd6894a66
No known key found for this signature in database
4 changed files with 63 additions and 1 deletions

View file

@ -41,6 +41,7 @@ defmodule Pleroma.Web.MediaProxy do
end
def url(url) when is_nil(url) or url == "", do: nil
def url("//" <> _ = url), do: url("https:" <> url)
def url("/" <> _ = url), do: url
def url(url) do
@ -56,7 +57,10 @@ defmodule Pleroma.Web.MediaProxy do
not local?(url) and not whitelisted?(url)
end
def preview_url(url, preview_params \\ []) do
def preview_url(url, preview_params \\ [])
def preview_url("//" <> _ = url, pparams), do: preview_url("https:" <> url, pparams)
def preview_url(url, preview_params) do
if preview_enabled?() do
encode_preview_url(url, preview_params)
else