projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[#570] add user:notification stream
[akkoma]
/
lib
/
pleroma
/
upload.ex
diff --git
a/lib/pleroma/upload.ex
b/lib/pleroma/upload.ex
index 1a97e9fdee156354fdb26e78bab931a2474e32d9..c47d6524111b3c40014b71b49a2a4d8d090f842d 100644
(file)
--- a/
lib/pleroma/upload.ex
+++ b/
lib/pleroma/upload.ex
@@
-4,7
+4,7
@@
defmodule Pleroma.Upload do
@moduledoc """
defmodule Pleroma.Upload do
@moduledoc """
- # Upload
+ Manage user uploads
Options:
* `:type`: presets for activity type (defaults to Document) and size limits from app configuration
Options:
* `:type`: presets for activity type (defaults to Document) and size limits from app configuration
@@
-70,7
+70,7
@@
defmodule Pleroma.Upload do
%{
"type" => "Link",
"mediaType" => upload.content_type,
%{
"type" => "Link",
"mediaType" => upload.content_type,
- "href" => url_from_spec(opts.base_url, url_spec)
+ "href" => url_from_spec(
upload,
opts.base_url, url_spec)
}
],
"name" => Map.get(opts, :description) || upload.name
}
],
"name" => Map.get(opts, :description) || upload.name
@@
-219,14
+219,18
@@
defmodule Pleroma.Upload do
tmp_path
end
tmp_path
end
- defp url_from_spec(base_url, {:file, path}) do
+ defp url_from_spec(
%__MODULE__{name: name},
base_url, {:file, path}) do
path =
path =
- path
- |> URI.encode(&char_unescaped?/1)
+ URI.encode(path, &char_unescaped?/1) <>
+ if Pleroma.Config.get([__MODULE__, :link_name], false) do
+ "?name=#{URI.encode(name, &char_unescaped?/1)}"
+ else
+ ""
+ end
[base_url, "media", path]
|> Path.join()
end
[base_url, "media", path]
|> Path.join()
end
- defp url_from_spec(_base_url, {:url, url}), do: url
+ defp url_from_spec(_
upload, _
base_url, {:url, url}), do: url
end
end