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
2 changed files with 4 additions and 2 deletions
|
@ -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 a new issue