common api: prefer formatting attachments using the attachment's name instead of URI
This commit is contained in:
parent
f61acdc5b4
commit
f407831120
1 changed files with 2 additions and 2 deletions
|
@ -89,8 +89,8 @@ def maybe_add_attachments(text, attachments, _no_links) do
|
||||||
def add_attachments(text, attachments) do
|
def add_attachments(text, attachments) do
|
||||||
attachment_text =
|
attachment_text =
|
||||||
Enum.map(attachments, fn
|
Enum.map(attachments, fn
|
||||||
%{"url" => [%{"href" => href} | _]} ->
|
%{"url" => [%{"href" => href} | _]} = attachment ->
|
||||||
name = URI.decode(Path.basename(href))
|
name = attachment["name"] || URI.decode(Path.basename(href))
|
||||||
href = MediaProxy.url(href)
|
href = MediaProxy.url(href)
|
||||||
"<a href=\"#{href}\" class='attachment'>#{shortname(name)}</a>"
|
"<a href=\"#{href}\" class='attachment'>#{shortname(name)}</a>"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue