From f0ab60189e0749ca207b483b291c90f892dce6a3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 13 Jan 2021 11:54:00 -0600 Subject: [PATCH] truncated_namespace should default to nil --- config/config.exs | 2 +- lib/pleroma/upload.ex | 6 ++++-- priv/templates/sample_config.eex | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/config.exs b/config/config.exs index 2a0c6302c..ef3baed93 100644 --- a/config/config.exs +++ b/config/config.exs @@ -72,7 +72,7 @@ config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads" config :pleroma, Pleroma.Uploaders.S3, bucket: nil, bucket_namespace: nil, - truncated_namespace: false, + truncated_namespace: nil, streaming_enabled: true config :ex_aws, :s3, diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index e714dc57b..e13d40c5a 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -229,13 +229,15 @@ defmodule Pleroma.Upload do Pleroma.Uploaders.S3 -> bucket = Config.get([Pleroma.Uploaders.S3, :bucket]) + truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace]) + namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace]) bucket_with_namespace = cond do - truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace]) -> + !is_nil(truncated_namespace) -> truncated_namespace - namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace]) -> + !is_nil(namespace) -> namespace <> ":" <> bucket true -> diff --git a/priv/templates/sample_config.eex b/priv/templates/sample_config.eex index 0c2477e2c..42f496ded 100644 --- a/priv/templates/sample_config.eex +++ b/priv/templates/sample_config.eex @@ -59,7 +59,7 @@ config :pleroma, Pleroma.Uploaders.Local, uploads: "<%= uploads_dir %>" # config :pleroma, Pleroma.Uploaders.S3, # bucket: "some-bucket", # bucket_namespace: "my-namespace", -# truncated_namespace: false, +# truncated_namespace: nil, # streaming_enabled: true # # Configure S3 credentials: -- 2.45.2