X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fmediafile.php;h=803cbe0a4cd6cece1f9d1e83540138d8912ab2b8;hb=489099ca917d74ee2bdc406cb26f9e3269ade625;hp=54d00b4acfefff266b7e1a600340181ff45be172;hpb=7ca0ff9a19d1d87dadc836659aa1c02e6e7c375c;p=quix0rs-gnu-social.git diff --git a/lib/mediafile.php b/lib/mediafile.php index 54d00b4acf..803cbe0a4c 100644 --- a/lib/mediafile.php +++ b/lib/mediafile.php @@ -355,6 +355,7 @@ class MediaFile $unclearTypes = array('application/octet-stream', 'application/vnd.ms-office', 'application/zip', + 'text/plain', 'text/html', // Ironically, Wikimedia Commons' SVG_logo.svg is identified as text/html // TODO: for XML we could do better content-based sniffing too 'text/xml'); @@ -364,10 +365,12 @@ class MediaFile // If we didn't match, or it is an unclear match if ($originalFilename && (!$mimetype || in_array($mimetype, $unclearTypes))) { try { - $type = common_supported_ext_to_mime($originalFilename); + $type = common_supported_filename_to_mime($originalFilename); return $type; + } catch (UnknownExtensionMimeException $e) { + // FIXME: I think we should keep the file extension here (supported should be === true here) } catch (Exception $e) { - // Extension not found, so $mimetype is our best guess + // Extension parsed but no connected mimetype, so $mimetype is our best guess } }