Uploads fun, part. 2

This commit is contained in:
href 2018-11-29 21:11:45 +01:00
commit 02d3dc6869
No known key found for this signature in database
GPG key ID: EE8296C1A152C325
17 changed files with 491 additions and 265 deletions

View file

@ -5,10 +5,11 @@ defmodule Pleroma.Uploaders.Swift do
{:ok, {:url, Path.join([Pleroma.Config.get!([__MODULE__, :object_url]), name])}}
end
def put_file(name, uuid, tmp_path, content_type, _opts) do
{:ok, file_data} = File.read(tmp_path)
remote_name = "#{uuid}/#{name}"
Pleroma.Uploaders.Swift.Client.upload_file(remote_name, file_data, content_type)
def put_file(upload) do
Pleroma.Uploaders.Swift.Client.upload_file(
upload.path,
File.read!(upload.tmpfile),
upload.content_type
)
end
end