Consider this scenario: a user has two images in a Sitecore media folder with the same name. They go into a content item (page) and into a rich text field to fill out the body of the page. They click Insert Sitecore Media and select one of the two images (let's call it Media Item A). They save, the HTML is updated and is referencing the media hash / ID of Media Item A. They publish Media Item A and the content item. On the site, they browse to the page and see Media Item B.
This is an issue that was just brought to my attention. I thought it was strange that they had two images with the same name, so I renamed Media Item B to something else and published to web. Sure enough, this fixed the issue - Media Item A is now appearing on the front end.
My question: if Sitecore is directly referencing Media Item A in the rich text field, why is Media Item B being displayed?