[Tickets #2507] NEW: MIME, analyzeFile limited regexp fails to recognize valid mime-types

bugs@bugs.horde.org bugs at bugs.horde.org
Wed Aug 24 11:10:30 PDT 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=2507
-----------------------------------------------------------------------
 Ticket             | 2507
 Created By         | leena.heino at uta.fi
 Summary            | MIME, analyzeFile limited regexp fails to recognize valid mime-types
 Queue              | Horde Framework Packages
 Version            | FRAMEWORK_3
 State              | Unconfirmed
 Priority           | 1. Low
 Type               | Bug
 Owners             | 
-----------------------------------------------------------------------


leena.heino at uta.fi (2005-08-24 11:10) wrote:

In MIME package and in analyzeFile() function there is this snippet of
code:
...
                if (preg_match('|^[a-z0-9]+/[a-z0-9]+$|', $type)) {
                    return $type;
                }
...

This regexp to check mime-type seems very limited and does not seem to match
to a valid mime-type like application/octet-stream.

I would suggest something like this:
if(preg_match('|^[a-z0-9]+/[a-z0-9]+(?:[.-][a-z0-9]+)*$|i', $type)) {
...
}




More information about the bugs mailing list