update mime types

This commit is contained in:
the-djmaze 2024-03-06 01:22:49 +01:00
parent c1385894cc
commit 8fe5cd3c95
3 changed files with 7 additions and 6 deletions

View file

@ -138,7 +138,7 @@ export const FileInfo = {
getContentType: fileName => {
fileName = lowerCase(fileName);
if ('winmail.dat' === fileName) {
return app + 'ms-tnef';
return app + 'vnd.ms-tnef';
}
let ext = fileName.split('.').pop();
if (/^(txt|text|def|list|in|ini|log|sql|cfg|conf)$/.test(ext))

View file

@ -103,7 +103,7 @@ abstract class MimeType
{
$filename = \strtolower($filename);
if ('winmail.dat' === $filename) {
return 'application/ms-tnef';
return static::$types['tnef'];
}
$extension = \explode('.', $filename);
$extension = \array_pop($extension);
@ -116,7 +116,7 @@ abstract class MimeType
public static function toExtension(string $mime, bool $include_dot = true) : ?string
{
$mime = \strtolower($mime);
if ('application/pgp-signature' == $mime || 'application/pgp-keys' == $mime) {
if ('application/pgp-signature' === $mime || 'application/pgp-keys' === $mime) {
$ext = 'asc';
} else {
$mime = \str_replace('application/x-tar', 'application/gtar', $mime);
@ -149,7 +149,6 @@ abstract class MimeType
'epub' => 'application/epub',
'exe' => 'application/x-msdownload',
'gz' => 'application/gzip',
'gz' => 'application/x-gzip',
'hlp' => 'application/winhlp',
'js' => 'application/javascript',
'json' => 'application/json',
@ -178,7 +177,9 @@ abstract class MimeType
'swf' => 'application/x-shockwave-flash',
'tar' => 'application/gtar',
// 'tar' => 'application/x-tar',
// 'tgz' => 'application/x-gzip',
// 'tgz' => 'application/gzip',
'tnef' => 'application/vnd.ms-tnef',
// 'tnef' => 'application/ms-tnef', // not IANA official
'torrent' => 'application/x-bittorrent',
'wgt' => 'application/widget',
'xls' => 'application/vnd.ms-excel',

View file

@ -53,7 +53,7 @@ class TAR
$name .= '.tgz';
$name = \preg_match('#^[\x01-\x7F]*$#D', $name) ? $name : '=?UTF-8?B?'.\base64_encode($name).'?=';
\header("Content-Disposition: attachment; filename={$name}");
\header("Content-Type: application/x-gzip; name={$name}");
\header("Content-Type: application/gzip; name={$name}");
} else {
$name .= '.tar';
$name = \preg_match('#^[\x01-\x7F]*$#D', $name) ? $name : '=?UTF-8?B?'.\base64_encode($name).'?=';