Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 39820)
+++ wp-includes/functions.php	(working copy)
@@ -2373,6 +2373,14 @@
 		} else {
 			$mime = false;
 		}
+		if( ( $mime === 'application/octet-stream' || $mime === false ) && function_exists ( 'finfo_file' ) ){
+			/* if the mime type is false or octet stream, its possible we are dealing with an image file not supported by PHP Constants (this applies at least to svg, but might apply to other file types) 
+			to fix this, use finfo to determine the mimetype instead
+			*/
+			$finfo = finfo_open( FILEINFO_MIME_TYPE );
+			$mime = finfo_file( $finfo, $file );
+			finfo_close( $finfo );
+		}
 	} catch ( Exception $e ) {
 		$mime = false;
 	}
