issue 12
(Non-idiomatic use of mime_type? method name) reported by tokland
- As far as I know, it's a well established Ruby idiom that methods ending
with "?" return a boolean, so it's somewhat weird to see File.mime_type?
return a string.
As far as I know, it's a well established Ruby idiom that methods ending
with "?" return a boolean, so it's somewhat weird to see File.mime_type?
return a string.
Jan 29, 2009
issue 3
(mymetype for filenams without extensions) commented on by mfvargo
- I ran into this. If the filename has no extension than file.rindex('.') returns nil
and that is used to call downcase_to_sym and causes the blow up. I fixed it by
putting the if file.rindex('.') condition before trying to read into the hash.
elsif file.class == String
mime = EXTENSIONS[(file[file.rindex('.')+1, file.size]).downcase.to_sym] if
file.rindex('.')
elsif file.class == StringIO
I ran into this. If the filename has no extension than file.rindex('.') returns nil
and that is used to call downcase_to_sym and causes the blow up. I fixed it by
putting the if file.rindex('.') condition before trying to read into the hash.
elsif file.class == String
mime = EXTENSIONS[(file[file.rindex('.')+1, file.size]).downcase.to_sym] if
file.rindex('.')
elsif file.class == StringIO