Apply Upload.base_url for S3
authorMark Felder <feld@feld.me>
Fri, 8 Jan 2021 16:49:12 +0000 (10:49 -0600)
committerMark Felder <feld@feld.me>
Fri, 8 Jan 2021 23:32:42 +0000 (17:32 -0600)
lib/pleroma/uploaders/s3.ex
test/pleroma/uploaders/s3_test.exs

index 6dbef90856c2fba0f9f5bddc52d56743cef7c81d..5a91410d7c51909e5cd1feb54d4610c1669e125a 100644 (file)
@@ -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))
       ])}}
index e7a013dd8e843311fd34447cdea762ac454be54a..344cf7abe7954a37959c8fa1e866285200395030 100644 (file)
@@ -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