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