From: Michael M Slusarz Date: Mon, 15 Dec 2008 19:19:41 +0000 (-0700) Subject: Fix MIME determination when no extension is present. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=527ac061df1d7dd48659b40105b61866262ca6c4;p=horde.git Fix MIME determination when no extension is present. --- diff --git a/framework/Mime/lib/Horde/Mime/Magic.php b/framework/Mime/lib/Horde/Mime/Magic.php index 9e9e5162d..5c2520b09 100644 --- a/framework/Mime/lib/Horde/Mime/Magic.php +++ b/framework/Mime/lib/Horde/Mime/Magic.php @@ -101,12 +101,14 @@ class Horde_Mime_Magic $map = self::_getMimeExtensionMap(); for ($i = 0; $i <= $map['__MAXPERIOD__']; ++$i) { - $pos = strrpos(substr($filename, 0, $pos - 1), '.') + 1; + $pos = strrpos(substr($filename, 0, $pos - 1), '.'); if ($pos === false) { break; } + ++$pos; } - $type = self::extToMime(substr($filename, $pos)); + + $type = ($pos === false) ? '' : self::extToMime(substr($filename, $pos)); return (empty($type) || (!$unknown && (strpos($type, 'x-extension') !== false))) ? 'application/octet-stream'