aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhref <href@random.sh>2019-01-21 14:42:16 +0100
committerhref <href@random.sh>2019-01-21 14:42:16 +0100
commit97412d9f94ed55caecb7a35e1f95aef7bdf0db19 (patch)
treeef4ab73689165e66562e37ce0e7d6fd94a47f3e1 /lib
parent646bb878164fadd5f30d37f9bbf7c313d69da209 (diff)
downloadpleroma-97412d9f94ed55caecb7a35e1f95aef7bdf0db19.tar.gz
S3 Namespace
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/uploaders/s3.ex10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/pleroma/uploaders/s3.ex b/lib/pleroma/uploaders/s3.ex
index 108cf06b5..fbd89616c 100644
--- a/lib/pleroma/uploaders/s3.ex
+++ b/lib/pleroma/uploaders/s3.ex
@@ -9,12 +9,20 @@ defmodule Pleroma.Uploaders.S3 do
# The file name is re-encoded with S3's constraints here to comply with previous links with less strict filenames
def get_file(file) do
config = Pleroma.Config.get([__MODULE__])
+ bucket = Keyword.fetch!(config, :bucket)
+
+ bucket_with_namespace =
+ if namespace = Keyword.get(config, :bucket_namespace) do
+ namespace <> ":" <> bucket
+ else
+ bucket
+ end
{:ok,
{:url,
Path.join([
Keyword.fetch!(config, :public_endpoint),
- Keyword.fetch!(config, :bucket),
+ bucket_with_namespace,
strict_encode(URI.decode(file))
])}}
end