add check-attachment hook