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,30 +242,65 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
// Fallback solution: try to guess the type by the file extension
// TODO: add more ...
switch (strtolower(strrchr(basename($fspath), "."))) {
case ".html":
$mime_type = "text/html";
break;
case ".txt":
$mime_type = "text/plain";
break;
case ".css":
$mime_type = "text/css";
break;
case ".gif":
$mime_type = "image/gif";
break;
case ".jpg":
$mime_type = "image/jpeg";
break;
case ".jpeg":
$mime_type = "image/jpeg";
break;
case ".png":
$mime_type = "image/png";
break;
default:
$mime_type = "application/octet-stream";
break;
case '.css':
$mime_type = 'text/css';
break;
case '.flac':
$mime_type = 'audio/flac';
break;
case '.gif':
$mime_type = 'image/gif';
break;
case '.gzip':
case '.gz':
$mime_type = 'application/x-gzip';
break;
case '.htm':
case '.html':
$mime_type = 'text/html';
break;
case '.jpeg':
case '.jpg':
$mime_type = 'image/jpeg';
break;
case '.js':
$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;
default:
$mime_type = 'application/octet-stream';
break;
}
}