projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Credo] write large numbers with underscore separation
[akkoma]
/
lib
/
pleroma
/
uploaders
/
s3.ex
diff --git
a/lib/pleroma/uploaders/s3.ex
b/lib/pleroma/uploaders/s3.ex
index 108cf06b555aaf86e8cfdd09ebc1e66a66eb2076..0038ba01fdc0104bf3f06df637be60ed985ddc12 100644
(file)
--- a/
lib/pleroma/uploaders/s3.ex
+++ b/
lib/pleroma/uploaders/s3.ex
@@
-9,17
+9,25
@@
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__])
# 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),
{:ok,
{:url,
Path.join([
Keyword.fetch!(config, :public_endpoint),
-
Keyword.fetch!(config, :bucket)
,
+
bucket_with_namespace
,
strict_encode(URI.decode(file))
])}}
end
strict_encode(URI.decode(file))
])}}
end
- def put_file(
upload = %Pleroma.Upload{}
) do
+ def put_file(
%Pleroma.Upload{} = upload
) do
config = Pleroma.Config.get([__MODULE__])
bucket = Keyword.get(config, :bucket)
config = Pleroma.Config.get([__MODULE__])
bucket = Keyword.get(config, :bucket)