Currently, the action ‘delete_attachment’ is performed after all data associated with the attachment in question has been removed from the database. It is therefore not possible to query custom attachment metadata in the action handler, which I would require for additional cleanup steps in a plugin.
Is there any reason why it is not possible to perform ‘delete_attachment’ before the database is updated? Because, honestly, the current setup doesn’t make a lot of sense to me, i.e. ‘delete_attachment’ handlers receive the post-id of the deleted attachment, which is, however, no longer valid and therefore useless.