huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
242 stars 80 forks source link

Preserve api is failing due to duplicated Thesaurus validation #6654

Open RafaPolit opened 7 months ago

RafaPolit commented 7 months ago

Describe the bug Trying to request a Preserve Token fails in validation due to the process trying to create a Thesaurus that already exists.

RafaPolit commented 7 months ago

On further debugging, the system does check if the template exists, and, if it does, it skips the process.

There are several scenarios where this could fail though, the most notable one is a collection where an admin deletes the Preserve template but doesn't delete the Preserve thesaurus.

The current flow would: a) assess that the template is not there, b) attempt to create the template, which, inside, tries to create the Thesaurus, simply assuming it doesn't exist.

The process needs to try to assess that the Preserve thesaurus exists, even if the template was not found, as there could be conflicts, previously deleted templates, or simply the coincidence of a user creating a Preserve thesaurus.