Added more MIME Types in `inc/lib_filestorage.php`

Here the types added:
  * Flac / Ogg [1]
  * GZip / Tar / Tar+GZip
  * PDF / SVG / Tiff
  * JavaScript

Other little changes:
  * I changed the ordered to be alphabetical (by extension)
  * Using single quotes instead of double quotes for strings
  * Indentation

[1]: http://wiki.xiph.org/MIME_Types_and_File_Extensions
[2]: http://www.asciitable.it/mimetypes.asp
This commit is contained in:
Aldo "xoen" Giambelluca 2010-07-11 19:51:26 +02:00
parent 0939d5c393
commit 50c067ffe8
1 changed files with 59 additions and 24 deletions

View File

@ -242,29 +242,64 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
// Fallback solution: try to guess the type by the file extension // Fallback solution: try to guess the type by the file extension
// TODO: add more ... // TODO: add more ...
switch (strtolower(strrchr(basename($fspath), "."))) { switch (strtolower(strrchr(basename($fspath), "."))) {
case ".html": case '.css':
$mime_type = "text/html"; $mime_type = 'text/css';
break; break;
case ".txt": case '.flac':
$mime_type = "text/plain"; $mime_type = 'audio/flac';
break; break;
case ".css": case '.gif':
$mime_type = "text/css"; $mime_type = 'image/gif';
break; break;
case ".gif": case '.gzip':
$mime_type = "image/gif"; case '.gz':
$mime_type = 'application/x-gzip';
break; break;
case ".jpg": case '.htm':
$mime_type = "image/jpeg"; case '.html':
$mime_type = 'text/html';
break; break;
case ".jpeg": case '.jpeg':
$mime_type = "image/jpeg"; case '.jpg':
$mime_type = 'image/jpeg';
break; break;
case ".png": case '.js':
$mime_type = "image/png"; $mime_type = 'application/x-javascript';
break;
case '.oga':
case '.ogg':
$mime_type = 'audio/ogg';
break;
case '.ogv':
$mime_type = 'video/ogg';
break;
case '.pdf':
$mime_type = 'application/pdf';
break;
case '.png':
$mime_type = 'image/png';
break;
case '.svg':
$mime_type = 'image/svg+xml';
break;
case '.tar':
$mime_type = 'application/x-tar';
break;
case '.tgz':
$mime_type = 'application/x-compressed';
break;
case '.tif':
case '.tiff':
$mime_type = 'image/tiff';
break;
case '.txt':
$mime_type = 'text/plain';
break;
case '.zip':
$mime_type = 'application/zip';
break; break;
default: default:
$mime_type = "application/octet-stream"; $mime_type = 'application/octet-stream';
break; break;
} }
} }