Allow for upper-case file extensions (JPG, GIF, PNG, JPEG)
rfay - October 2, 2009 - 23:49
| Project: | ImageField |
| Version: | 6.x-3.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
It may not matter on a Windows or Mac-based browser, but allowing PICTURENAME.JPG, etc. is important on a Linux machine that differentiates upper and lower case in the filesystem.
This patch adds JPG, JPEG, PNG, and GIF to the allowed extensions.
| Attachment | Size |
|---|---|
| imagefield_uppper_case_extensions_patch.patch | 861 bytes |

#1
The actual check done when validating the image is not case-sensitive, so there is no need to enter both "PNG" and "png" on the settings page. See http://api.lullabot.com/file_validate_extensions (the "/i" in the RegEx means "insensitive").
#2
Hi quicksketch! thanks for your reply, but I disagree. Try it on linux! It's impossible to select a .JPG to upload, because the options in the dialog box allow only .jpg, and it's case sensitive on a linux file system.
And of course, thanks for maintaining this awesome module.
#3
Thanks rfay, but it seems like this is fixing it in the wrong place. We should fix the actual extension check rather than just allowing the admin to enter in variations on the extension. For example Jpg and jPG really should be allowed also, we don't want them to have to type in all those extensions separately! A cheap way to get around this problem entirely is to install Transliteration module, which will make all filenames lowercase and "safe" before they even get to FileField/ImageField. But of course it would be preferable to fix the problem directly. I'm making new versions of FileField and ImageField today, so I'd be happy to get this change in before then.
#4
OK, I'll try to figure out what I was smoking. But it was real, I swear it.
#5
Marking as duplicate of #497916: Allow Uppercase Extensions (i.e. JPG and jpg)