projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[#923] OAuth consumer params handling refactoring.
[akkoma]
/
lib
/
pleroma
/
upload.ex
diff --git
a/lib/pleroma/upload.ex
b/lib/pleroma/upload.ex
index 1a97e9fdee156354fdb26e78bab931a2474e32d9..f7233493024259489c44a78826985442f111a19c 100644
(file)
--- a/
lib/pleroma/upload.ex
+++ b/
lib/pleroma/upload.ex
@@
-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