If you have 2 media items that have the same name but different extensions, Sitecore cannot differentiate between them.
For example:
/~/media/myfile.pdf
/~/media/myfile.doc
When these URL's are requested, the PDF file is returned in both cases.
I understand that that Sitecore ignores the extension in the request, and that the real problem is in fact, that I essentially have two items with the same path in the media library:
sitecore/media library/myfile
However, I do think it's a reasonable that our customer would want to store both PDF and DOC versions of the same document in a single node.
I found this article which addresses the related problem of ensuring that the requested media item file extension is valid:
http://www.cognifide.com/blogs/sitecore/sitecore-serves-media-items-even-with-incorrect-extensions/
However, this is still based on the premise that you have obtained the correct Sitecore item in the first place (which isn't true in the case of the request for myfile.doc).
So I guess my question is whether there is a way prevent Sitecore from simply getting the first item it finds and to take the extension into account.