nova-issues icon indicating copy to clipboard operation
nova-issues copied to clipboard

Trix field does not purge pending field attachments and adding it to the content.

Open albertcat opened this issue 7 months ago • 0 comments

  • Laravel Version: 11.16.0
  • Nova Version: 4.34.3
  • PHP Version: 8.3.9

Description:

When adding and attachment on a Trix field, it is correctly inserted on the nova_pending_field_attachments table via the API. But if you do not save the page and discard the attachment (remove it from the Trix field using the X button) and then save the content of the field, the attachment is not deleted form the pending table and it is transferred to the nova_fields_attachment table, even though it was removed from the field. This leaves the database in an unconsistent state.

I think the problem is that when removing the attachment, the Trix field uses the same DELETE call to remove the attachment regardless if the attachment is a draft or not. Meaning that removing a draft attachment will never call the correct endpoint to purge the pending_attachments table.

albertcat avatar Jul 18 '24 15:07 albertcat