uwazi
uwazi copied to clipboard
Validate attachments referenced in entities' metadata
The work done in https://github.com/huridocs/uwazi/pull/4275 allows to send API calls that have new supporting files already referenced in a metadata image or media field. This avoids having to create/update the entity with supporting files first, and then save the entity again with the references to the supporting file in the media or image fields.
The following issues where detected during development:
-
And entity's metadata property can have a new value called
attachment
that references the index number of the new supporting file. Upon entity saveattachment
is used to form thevalue
property pointing to the file,attachment
is never saved on the database. Sincevalue
is as a mandatory property, when doing the API call, the user needs to send and emptyvalue
alongsideattachment
to pass validation. It would be better ifvalue
was not required ifattachment
is present. -
The
attachment
property can be sent in any metadata property, but only image and media fields can reference files. -
If the process to save the file fails, the entity will still have the reference to the file in the metadata.