X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fupload.ex;fp=lib%2Fpleroma%2Fupload.ex;h=2f65540be3aec7cc5c9dfdc1dc59d97e9d3d3890;hb=85048781871efe8c9abda3f2ca44b7e17f8ab84c;hp=3b5419db74309e650e08bd78f9386fa78e59d16c;hpb=fef4bae0067fcd6e102e3d625390e8ae909c6bb8;p=akkoma diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 3b5419db7..2f65540be 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -65,15 +65,6 @@ defmodule Pleroma.Upload do } defstruct [:id, :name, :tempfile, :content_type, :width, :height, :blurhash, :path] - defp get_description(opts, upload) do - case {opts[:description], Pleroma.Config.get([Pleroma.Upload, :default_description])} do - {description, _} when is_binary(description) -> description - {_, :filename} -> upload.name - {_, str} when is_binary(str) -> str - _ -> "" - end - end - @spec store(source, options :: [option()]) :: {:ok, Map.t()} | {:error, any()} @doc "Store a file. If using a `Plug.Upload{}` as the source, be sure to use `Majic.Plug` to ensure its content_type and filename is correct." def store(upload, opts \\ []) do @@ -82,7 +73,7 @@ defmodule Pleroma.Upload do with {:ok, upload} <- prepare_upload(upload, opts), upload = %__MODULE__{upload | path: upload.path || "#{upload.id}/#{upload.name}"}, {:ok, upload} <- Pleroma.Upload.Filter.filter(opts.filters, upload), - description = get_description(opts, upload), + description = Map.get(opts, :description) || "", {_, true} <- {:description_limit, String.length(description) <= Pleroma.Config.get([:instance, :description_limit])},