Merge pull request 'MediaProxy: proxy network-path URLs (//host/path)' (#8027) from lambadalambda/pleroma:fix/media-proxy-network-path into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8027
This commit is contained in:
lain 2026-10-28 05:03:14 +00:00
commit 24738790c3
5 changed files with 64 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