Apply 4 suggestion(s) to 2 file(s)

This commit is contained in:
feld 2021-01-10 01:34:54 +00:00
parent e8bf060e6e
commit fa63f1b55b
2 changed files with 12 additions and 27 deletions

View File

@ -237,13 +237,7 @@ defmodule Pleroma.Upload do
case uploader do
Pleroma.Uploaders.Local ->
cond do
!is_nil(upload_base_url) ->
upload_base_url
true ->
Pleroma.Web.base_url() <> "/media/"
end
upload_base_url || Pleroma.Web.base_url() <> "/media/"
Pleroma.Uploaders.S3 ->
bucket = Config.get([Pleroma.Uploaders.S3, :bucket])
@ -260,22 +254,14 @@ defmodule Pleroma.Upload do
bucket
end
cond do
!is_nil(public_endpoint) ->
Path.join([public_endpoint, bucket_with_namespace])
true ->
Path.join([upload_base_url, bucket_with_namespace])
if public_endpoint do
Path.join([public_endpoint, bucket_with_namespace])
else
Path.join([upload_base_url, bucket_with_namespace])
end
_ ->
cond do
!is_nil(public_endpoint) ->
public_endpoint
true ->
upload_base_url
end
public_endpoint || upload_base_url
end
end
end

View File

@ -80,13 +80,12 @@ defmodule Pleroma.Web.MediaProxy do
|> Enum.map(&maybe_get_domain_from_url/1)
whitelist_domains =
cond do
Web.base_url() == Upload.base_url() ->
mediaproxy_whitelist_domains
true ->
%{host: base_domain} = URI.parse(Upload.base_url())
[base_domain | mediaproxy_whitelist_domains]
base_url = Upload.base_url()
if Web.base_url() == base_url do
mediaproxy_whitelist_domains
else
%{host: base_domain} = URI.parse(base_url)
[base_domain | mediaproxy_whitelist_domains]
end
domain in whitelist_domains