Use hash of attachment url as id.
Pretty hacky, let's see if we can get away with this.
This commit is contained in:
parent
44a650235b
commit
b58b35bf56
|
@ -61,8 +61,10 @@ def render("attachment.json", %{attachment: attachment}) do
|
|||
true -> "unknown"
|
||||
end
|
||||
|
||||
<< hash_id::32, _rest::binary >> = :crypto.hash(:md5, href)
|
||||
|
||||
%{
|
||||
id: attachment["uuid"],
|
||||
id: attachment["id"] || hash_id,
|
||||
url: href,
|
||||
remote_url: href,
|
||||
preview_url: href,
|
||||
|
|
|
@ -65,7 +65,7 @@ test "attachments" do
|
|||
}
|
||||
|
||||
expected = %{
|
||||
id: 6,
|
||||
id: 1638338801,
|
||||
type: "image",
|
||||
url: "someurl",
|
||||
remote_url: "someurl",
|
||||
|
|
Loading…
Reference in New Issue