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 => { getContentType: fileName => {
fileName = lowerCase(fileName); fileName = lowerCase(fileName);
if ('winmail.dat' === fileName) { if ('winmail.dat' === fileName) {
return app + 'ms-tnef'; return app + 'vnd.ms-tnef';
} }
let ext = fileName.split('.').pop(); let ext = fileName.split('.').pop();
if (/^(txt|text|def|list|in|ini|log|sql|cfg|conf)$/.test(ext)) 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); $filename = \strtolower($filename);
if ('winmail.dat' === $filename) { if ('winmail.dat' === $filename) {
return 'application/ms-tnef'; return static::$types['tnef'];
} }
$extension = \explode('.', $filename); $extension = \explode('.', $filename);
$extension = \array_pop($extension); $extension = \array_pop($extension);
@ -116,7 +116,7 @@ abstract class MimeType
public static function toExtension(string $mime, bool $include_dot = true) : ?string public static function toExtension(string $mime, bool $include_dot = true) : ?string
{ {
$mime = \strtolower($mime); $mime = \strtolower($mime);
if ('application/pgp-signature' == $mime || 'application/pgp-keys' == $mime) { if ('application/pgp-signature' === $mime || 'application/pgp-keys' === $mime) {
$ext = 'asc'; $ext = 'asc';
} else { } else {
$mime = \str_replace('application/x-tar', 'application/gtar', $mime); $mime = \str_replace('application/x-tar', 'application/gtar', $mime);
@ -149,7 +149,6 @@ abstract class MimeType
'epub' => 'application/epub', 'epub' => 'application/epub',
'exe' => 'application/x-msdownload', 'exe' => 'application/x-msdownload',
'gz' => 'application/gzip', 'gz' => 'application/gzip',
'gz' => 'application/x-gzip',
'hlp' => 'application/winhlp', 'hlp' => 'application/winhlp',
'js' => 'application/javascript', 'js' => 'application/javascript',
'json' => 'application/json', 'json' => 'application/json',
@ -178,7 +177,9 @@ abstract class MimeType
'swf' => 'application/x-shockwave-flash', 'swf' => 'application/x-shockwave-flash',
'tar' => 'application/gtar', 'tar' => 'application/gtar',
// 'tar' => 'application/x-tar', // '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', 'torrent' => 'application/x-bittorrent',
'wgt' => 'application/widget', 'wgt' => 'application/widget',
'xls' => 'application/vnd.ms-excel', 'xls' => 'application/vnd.ms-excel',

View file

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