Apply Upload.base_url for S3

This commit is contained in:
Mark Felder 2021-01-08 10:49:12 -06:00
parent ad79983614
commit 3c936061d5
2 changed files with 11 additions and 6 deletions

View File

@ -30,7 +30,7 @@ def get_file(file) do
{:ok, {:ok,
{:url, {:url,
Path.join([ Path.join([
Keyword.fetch!(config, :public_endpoint), Pleroma.Upload.base_url(),
bucket_with_namespace, bucket_with_namespace,
strict_encode(URI.decode(file)) strict_encode(URI.decode(file))
])}} ])}}

View File

@ -11,11 +11,16 @@ defmodule Pleroma.Uploaders.S3Test do
import Mock import Mock
import ExUnit.CaptureLog import ExUnit.CaptureLog
setup do: setup do
clear_config(Pleroma.Upload,
uploader: Pleroma.Uploaders.S3
)
clear_config(Pleroma.Uploaders.S3, clear_config(Pleroma.Uploaders.S3,
bucket: "test_bucket", bucket: "test_bucket",
public_endpoint: "https://s3.amazonaws.com" public_endpoint: "https://s3.amazonaws.com"
) )
end
describe "get_file/1" do describe "get_file/1" do
test "it returns path to local folder for files" do test "it returns path to local folder for files" do