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
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.

AttachmentSize
imagefield_uppper_case_extensions_patch.patch861 bytes

#1

quicksketch - October 20, 2009 - 19:01
Category:bug report» support request
Status:needs review» fixed

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

rfay - October 20, 2009 - 19:05
Category:support request» bug report
Status:fixed» needs review

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

quicksketch - October 20, 2009 - 19:35
Status:needs review» needs work

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

rfay - October 20, 2009 - 20:00
Status:needs work» closed

OK, I'll try to figure out what I was smoking. But it was real, I swear it.

#5

rfay - October 20, 2009 - 20:06
Status:closed» duplicate

Marking as duplicate of #497916: Allow Uppercase Extensions (i.e. JPG and jpg)

 
 

Drupal is a registered trademark of Dries Buytaert.