[3880] trunk/htdocs/system/classes/utils.php: make mimetype work if full content type string with encoding is returned.

0 views
Skip to first unread message

svn-N...@habariproject.org

unread,
Dec 13, 2009, 2:58:28 PM12/13/09
to habar...@googlegroups.com
Revision
3880
Author
MattRead
Date
2009-12-13 19:58:27 +0000 (Sun, 13 Dec 2009)

Log Message

make mimetype work if full content type string with encoding is returned.

Modified Paths

Diff

Modified: trunk/htdocs/system/classes/utils.php (3879 => 3880)


--- trunk/htdocs/system/classes/utils.php	2009-12-13 05:14:06 UTC (rev 3879)
+++ trunk/htdocs/system/classes/utils.php	2009-12-13 19:58:27 UTC (rev 3880)
@@ -858,6 +858,12 @@
 		if ( function_exists('finfo_open') ) {
 			$finfo = finfo_open(FILEINFO_MIME);
 			$mimetype = finfo_file($finfo, $filename);
+			/* FILEINFO_MIME Returns the mime type and mime encoding as defined by RFC 2045.
+			 * So only return the mime type, not the encoding.
+			 */
+			if ( ( $pos = strpos($mimetype, ';') ) !== FALSE ) {
+				$mimetype = substr($mimetype, 0, $pos);
+			}
 			finfo_close($finfo);
 		}
 
Reply all
Reply to author
Forward
0 new messages