On Jul 19, 2007, at 6:05 AM, Raf Coremans wrote:

> 2007/7/18, Daniel Berger <djberg96 / gmail.com>:
> <snip>
>
>>    def self.jpg?(file)
>>       IO.read(file, 10) == "\377\330\377\340\000\020JFIF" &&
>> File.extname(file).downcase == '.jpg'
>>    end
>
>
> Ack! The proper abbreviation, and thus also the filename extension, is
> 'jpeg'. 'jpg' is an abomination introduced by the same people who  
> introduced
> the *shudder* '.htm' filename extension.
>
>
> R.
Regardless, .JPG is what you get from most digital cameras! Nothing  
is ever guaranteed forever...!
As for .htm  it is meaningless, as is .html
All that matters is the .conf or .htaccess declaration, and the mime  
type(s).
html/xhtml is often served with .php, .pl, .rhtml, .py etc...

The point of all of this is the same as my OP: file extensions are  
meaningless. Only Windows and poorly written apps really rely on them.
A file is a file is a file. It's what's inside that matters.  
(usually) The extensions are intended for humans to easily identify a  
file and to help extend the name spaces. In addition it makes some  
processing easier when looking for particular extensions ( C files  
for example with .h and .c )
Anticipating particular extensions is fine,  But checking should  
still occur.
extensions do get deleted or munged. Especially at the hands of users  
clicking on things in a desktop GUI.

John Joyce