I am trying to create a plugin to prevent duplicate attachments from XMLRPC calls "metaWeblog.newMediaObject". The idea is, before wp_insert_attachment function is called, you generate a unique hash of the file, and check against the database. Each attachment insert will save the unique hash of the file. If there is a match, then don't save the same file and return the guid of the existing file.
However, I can't seem to be able to find a hook for wp_insert_attachment. Looking through the function, there are no do_action or do_filter for me to hook onto.
Can anyone suggest another route to accomplish this?