projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[#534] Various tweaks. Tests for Instances and Instance.
[akkoma]
/
lib
/
pleroma
/
uploaders
/
s3.ex
diff --git
a/lib/pleroma/uploaders/s3.ex
b/lib/pleroma/uploaders/s3.ex
index 19832a7ecc456e38390d1d931370bb1402d3a2dd..fbd89616c5b1e7f462c7f75e143fe486973e8ea1 100644
(file)
--- a/
lib/pleroma/uploaders/s3.ex
+++ b/
lib/pleroma/uploaders/s3.ex
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Uploaders.S3 do
@behaviour Pleroma.Uploaders.Uploader
require Logger
defmodule Pleroma.Uploaders.S3 do
@behaviour Pleroma.Uploaders.Uploader
require Logger
@@
-5,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__])
# 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