Check if mimetype handler exists in delete_related_files signal handler.

Review Request #13512 — Created Jan. 31, 2024 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

File attachments recently gained the ability to delete related files
when the main file is deleted. This can include things like images
deleting thumbnail versions, or Office documents deleting PDF copies.

This new code wasn't checking if the mimetype_handler existed, which
meant if we ended up with an attachment that didn't have a mimetype
specified, it would crash.

Was able to delete file attachments that didn't have the mimetype
field set.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Check if mimetype handler exists in delete_related_files signal handler.
File attachments recently gained the ability to delete related files when the main file is deleted. This can include things like images deleting thumbnail versions, or Office documents deleting PDF copies. This new code wasn't checking if the mimetype_handler existed, which meant if we ended up with an attachment that didn't have a mimetype specified, it would crash. Testing Done: Was able to delete file attachments that didn't have the `mimetype` field set.
07f8144dc77862f1650530759740a382e4d6e8d9 David Trowbridge
reviewboard/attachments/signal_handlers.py
Loading...