Use hash of attachment url as id.

Pretty hacky, let's see if we can get away with this.
This commit is contained in:
Roger Braun 2017-09-12 11:28:12 +02:00
parent 44a650235b
commit b58b35bf56
2 changed files with 4 additions and 2 deletions

View file

@ -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,

View file

@ -65,7 +65,7 @@ test "attachments" do
}
expected = %{
id: 6,
id: 1638338801,
type: "image",
url: "someurl",
remote_url: "someurl",