Duplicate asset links names are not handled gracefully in release UI and API
Problem to solve
If a user tries to create a new release through the New Release page and enters two asset links that have the same name, they get a generic error message:
However, this is not validated by the frontend, so it's unclear to the user what went wrong. In contrast, the frontend does validate that the asset link URLs are unique, and disables the Create release button if not.
Similarly, if the user is instead creating a release through the API, they get an ugly, technical error message:
{
message: "PG::UniqueViolation: ERROR: duplicate key value violates unique constraint \"index_release_links_on_release_id_and_name\"\nDETAIL: Key (release_id, name)=(2102687, My link title) already exists.\n"
}
A similar error message is shown if URLs are duplicate.
Proposal
We should do three things:
- Add frontend validation for duplicate link names
- Update the backend to send a nicer validation message in the case of duplicate link names
- Same as above, but for duplicate link URLs
Edited by Nathan Friend