Delete associated files when file attachments get completely deleted.

Review Request #13142 — Created July 13, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-6.x

Reviewers

Currently, when file attachments get completely deleted from the database we
keep their associated files lying around. There's no good reason to do this,
when the file attachment gets deleted we have no way of accessing these files
anymore.

This change deletes associated files from the filesystem when file
attachments get deleted. Any files created by the MimetypeHandler will be
deleted, and then the main file of the file attachment will be deleted.

  • Tested deleting draft .png file attachments that have thumbnail files,
    saw that they were deleted.
  • Tested deleting draft .txt files.
  • Tested deleting published files, saw that their files weren't deleted.
  • Tested deleting a draft revision of a file attachment that has
    been published before (has a history), saw that only the files for
    the draft revision were deleted.

Commits

Files

    Loading...