dmreagan / collectome

https://collectome.rt.iu.edu/
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Edit fails: dupid #62

Closed dmreagan closed 4 years ago

dmreagan commented 4 years ago

To reproduce:

  1. Copy a collection.
  2. Try to edit the collection.

Result is error: Sanity check failed. title already used

dmreagan commented 4 years ago

Alternatively:

  1. Create a new collection.
  2. Try to edit the collection.

Result is error: Sanity check failed. title already used

guangchen commented 4 years ago

This is the issue I mentioned before which is caused by allowing user "name the id". Since the backend logic has no way to distinguish the two cases: (1) the exhibit currently being edited will have an id conflict with another exhibit since the user edited id is already used; and (2) there is no id conflict at all since the user just edits parts other than the id. As for the backend's prospective, when doing the sanity check the id of the committed exhibit already exists.

Hence the sanity check fails the case (2) even though it is legitimate.

To keep using the original id, the workaround is to use a temp id for the first edit submission, and then change it back for the second edit submission.