Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#4 | add-_-to-file-extension-1070192-4.patch | 1.11 KB | exlin |
Comments
Comment #1
iccle CreditAttribution: iccle commentedThis 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.
Comment #2
iccle CreditAttribution: iccle commentedOk 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.
Comment #3
yched CreditAttribution: yched commentedrecategorizing
Comment #4
exlin CreditAttribution: exlin commentedIs there any reason security vice not to implement this to core?
Comment #5
yched CreditAttribution: yched commentedre-recategorizing :-)