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.

Changes between revision 3 and 4

orig
1
2
3
4

Commits

Summary ID Author
Delete associated files when draft file attachments get deleted.
fd1283387df474f5af9bd90bf3c7197bd0983242 Michelle Aubin
Delete associated files when file attachments get completely deleted.
9807aee29beba5ed20f5297ddf9336733c665959 Michelle Aubin
reviewboard/attachments/apps.py
reviewboard/attachments/signal_handlers.py
Loading...