From: Mark Felder Date: Fri, 8 Jan 2021 16:49:12 +0000 (-0600) Subject: Apply Upload.base_url for S3 X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=3c936061d55c1c4bd9346471bc498dd123395766;p=akkoma Apply Upload.base_url for S3 --- diff --git a/lib/pleroma/uploaders/s3.ex b/lib/pleroma/uploaders/s3.ex index 6dbef9085..5a91410d7 100644 --- a/lib/pleroma/uploaders/s3.ex +++ b/lib/pleroma/uploaders/s3.ex @@ -30,7 +30,7 @@ defmodule Pleroma.Uploaders.S3 do {:ok, {:url, Path.join([ - Keyword.fetch!(config, :public_endpoint), + Pleroma.Upload.base_url(), bucket_with_namespace, strict_encode(URI.decode(file)) ])}} diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index e7a013dd8..344cf7abe 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -11,11 +11,16 @@ defmodule Pleroma.Uploaders.S3Test do import Mock import ExUnit.CaptureLog - setup do: - clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com" - ) + setup do + clear_config(Pleroma.Upload, + uploader: Pleroma.Uploaders.S3 + ) + + clear_config(Pleroma.Uploaders.S3, + bucket: "test_bucket", + public_endpoint: "https://s3.amazonaws.com" + ) + end describe "get_file/1" do test "it returns path to local folder for files" do