only text/plain is now used to generate text previews

blacklist implementation remove because no longer needed
This commit is contained in:
Thomas Müller 2013-10-11 00:25:34 +02:00
parent 26c0007a5f
commit 51e6565aab
1 changed files with 10 additions and 11 deletions

View File

@ -9,20 +9,19 @@ namespace OC\Preview;
class TXT extends Provider {
private static $blacklist = array(
'text/calendar',
'text/vcard',
);
public function getMimeType() {
return '/text\/.*/';
return '/text\/plain/';
}
/**
* @param string $path
* @param int $maxX
* @param int $maxY
* @param boolean $scalingup
* @param \OC\Files\View $fileview
* @return bool|\OC_Image
*/
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
$mimetype = $fileview->getMimeType($path);
if(in_array($mimetype, self::$blacklist)) {
return false;
}
$content = $fileview->fopen($path, 'r');
$content = stream_get_contents($content);
@ -80,4 +79,4 @@ class JavaScript extends TXT {
}
\OC\Preview::registerProvider('OC\Preview\JavaScript');
\OC\Preview::registerProvider('OC\Preview\JavaScript');