Make MimetypeHandlers take care of deleting associated files for a file attachment.

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

Information

Review Board
release-6.x

Reviewers

Currently we have no centralized method for deleting extra files associated
with file attachments, such as thumbnail files. This adds a
delete_associated_files method to the base MimetypeHandler class, which
can be implemented by subclasses to take care of deleting any extra associated
files that are created for file attachments of certain mimetypes. This also
updates the ImageMimetype class to delete the files it creates for thumbnails.

  • Tested in an upcoming change where deleting draft file attachments will
    trigger deleting all files associated with the draft.
  • Ran unit tests.

Changes between revision 1 and 2

orig
1
2
3
4
5

Commits

Summary ID Author
Make MimetypeHandlers take care of deleting associated files.
890c0ac5f9f90eb78fd5c80eecf9c5c6ba57e900 Michelle Aubin
Make MimetypeHandlers take care of deleting associated files.
9d92b9af22ed0348151e5042e975fb73402e0a3e Michelle Aubin
reviewboard/attachments/mimetypes.py
reviewboard/attachments/tests.py
Loading...