Skip to content

Commit

Permalink
update mime types
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Mar 6, 2024
1 parent c138589 commit 8fe5cd3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dev/Common/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
9 changes: 5 additions & 4 deletions snappymail/v/0.0.0/app/libraries/snappymail/file/mimetype.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static function fromFilename(string $filename) : ?string
{
$filename = \strtolower($filename);
if ('winmail.dat' === $filename) {
return 'application/ms-tnef';
return static::$types['tnef'];
}
$extension = \explode('.', $filename);
$extension = \array_pop($extension);
Expand All @@ -116,7 +116,7 @@ public static function fromFilename(string $filename) : ?string
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);
Expand Down Expand Up @@ -149,7 +149,6 @@ public static function toExtension(string $mime, bool $include_dot = true) : ?st
'epub' => 'application/epub',
'exe' => 'application/x-msdownload',
'gz' => 'application/gzip',
'gz' => 'application/x-gzip',
'hlp' => 'application/winhlp',
'js' => 'application/javascript',
'json' => 'application/json',
Expand Down Expand Up @@ -178,7 +177,9 @@ public static function toExtension(string $mime, bool $include_dot = true) : ?st
'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',
Expand Down
2 changes: 1 addition & 1 deletion snappymail/v/0.0.0/app/libraries/snappymail/stream/tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function pushHttpHeaders(string $name) : void
$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).'?=';
Expand Down

0 comments on commit 8fe5cd3

Please sign in to comment.