1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Uploaders.Local do
6 @behaviour Pleroma.Uploaders.Uploader
9 {:ok, {:static_dir, upload_path()}}
12 def put_file(upload) do
14 case Enum.reverse(Path.split(upload.path)) do
19 path = Path.join([upload_path()] ++ Enum.reverse(folders))
24 result_file = Path.join(local_path, file)
26 if not File.exists?(result_file) do
27 File.cp!(upload.tempfile, result_file)
34 Pleroma.Config.get!([__MODULE__, :uploads])