When trying to setup a field to upload quake live demos with filename 'dm_73' i get the following error:
The list of allowed extensions is not valid, be sure to exclude leading dots and to separate extensions with a comma or space.

CommentFileSizeAuthor
#4 add-_-to-file-extension-1070192-4.patch1.11 KBexlin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iccle’s picture

This seems to be down to a regex in file.field.inc line 146
if (!preg_match('/^([a-z0-9]+([.][a-z0-9])* ?)+$/', $extensions)) {

Is there a way i can override this behavior without hacking code? I was able to upload files with this extension in Drupal 6, and need the same functionality in order to upgrade our site.

iccle’s picture

Priority: Normal » Major

Ok the only option i have had (as far as i can tell) in order to get my site working as it should, is to hack the core :(

By changing line 146 of /modules/file/file.field.inc from:
if (!preg_match('/^([a-z0-9]+([.][a-z0-9])* ?)+$/', $extensions)) {
to:
if (!preg_match('/^([a-z0-9_]+([.][a-z0-9_])* ?)+$/', $extensions)) {

I can now add quake demo files in my file field, im pretty certain that the regex is not as efficient/tight as it could be ill delve into that at a later point.

yched’s picture

Component: field system » file system

recategorizing

exlin’s picture

Component: file system » field system
Priority: Major » Normal
Status: Active » Needs review
FileSize
1.11 KB

Is there any reason security vice not to implement this to core?

yched’s picture

Component: field system » file system

re-recategorizing :-)

Version: 7.0 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.