Replaced attachment
I think is possible for several attachments in an analysis to reference the same couchdb attachment.
The attachment name is determined by jpath + filename. But filename unicity within a jpath is not enforced.
Orphan attachment
I think right now we have orphan attachments when both are true:
- We replace an existing analysis attachment (same entry id + jpath + reference + attachment field)
- The filename is different
We should probably remove the previous attachment when this happens.