fixing bug #5200

Verifying if the publication still exists when an attachment is removed