| Summary | MIME, analyzeFile limited regexp fails to recognize valid mime-types | 
| Queue | Horde Framework Packages | 
| Queue Version | FRAMEWORK_3 | 
| Type | Bug | 
| State | Resolved | 
| Priority | 1. Low | 
| Owners | |
| Requester | leena.heino (at) uta (dot) fi | 
| Created | 08/24/2005 (7377 days ago) | 
| Due | |
| Updated | 08/30/2005 (7371 days ago) | 
| Assigned | |
| Resolved | 08/24/2005 (7377 days ago) | 
| Github Issue Link | |
| Github Pull Request | |
| Milestone | |
| Patch | No | 
Should the regexp try to match to a mime-type that has whitespace around it.
have much larger problems than this regexp matching the MIME type.
file is either going to return an error string - which won't come
anywhere close to matching the regexp - or a MIME type which the
current regexp matches fine.
like text/.--..-...-..-.
State ⇒ Resolved
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ MIME, analyzeFile limited regexp fails to recognize valid mime-types
Queue ⇒ Horde Framework Packages
...
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)) {
...
}