diff --git a/lib/nerves_hub_web/live/firmware.ex b/lib/nerves_hub_web/live/firmware.ex index 3e9b0907a..dd6c860c8 100644 --- a/lib/nerves_hub_web/live/firmware.ex +++ b/lib/nerves_hub_web/live/firmware.ex @@ -140,6 +140,22 @@ defmodule NervesHubWeb.Live.Firmware do }} -> error_feedback(socket, "No matching product could be found.") + {:error, + %Ecto.Changeset{ + errors: [ + uuid: + {"has already been taken", + [constraint: :unique, constraint_name: "firmwares_product_id_uuid_index"]} + ] + } = c} -> + route = + "/org/#{socket.assigns.org.name}/#{socket.assigns.product.name}/firmware/#{c.changes.uuid}" + + error_feedback( + socket, + "Duplicate firmware - View Firmware" + ) + {:error, %Ecto.Changeset{}} -> error_feedback(socket, "Unknown error uploading firmware.") diff --git a/lib/nerves_hub_web/live/firmware_templates/upload_firmware_template.html.heex b/lib/nerves_hub_web/live/firmware_templates/upload_firmware_template.html.heex index fa8898276..270ef4dfe 100644 --- a/lib/nerves_hub_web/live/firmware_templates/upload_firmware_template.html.heex +++ b/lib/nerves_hub_web/live/firmware_templates/upload_firmware_template.html.heex @@ -9,7 +9,7 @@ <.live_file_input upload={@uploads.firmware} required />
- <%= @error_message %> + <%= raw(@error_message) %>