I've been struggling with this too. Since attachments like images and pdfs have a URL I tried searching for terms within the URL like "user-attachments" or "githubusercontent", with some success but not reliably. Maybe someone can suggest an improvement on that.