summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-10-16 14:21:40 -0700
committerMorris Jobke <morris.jobke@gmail.com>2013-10-16 14:21:40 -0700
commit04783da829d76667079eda56d1f8b66d70813b3d (patch)
treed6bf91b8dea7255c51bdb71b471d991ac59937b0 /lib/private
parenta132144ecab68357abd9f387b41fc868b5b01981 (diff)
parentaca66270c7e86fc125a8bcce5affc584d7d82a60 (diff)
downloadnextcloud-server-04783da829d76667079eda56d1f8b66d70813b3d.tar.gz
nextcloud-server-04783da829d76667079eda56d1f8b66d70813b3d.zip
Merge pull request #5276 from owncloud/fixing-5170-master
only text/plain is now used to generate text previews
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/preview/txt.php35
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php
index 77e728eb364..c9aa20968d8 100644
--- a/lib/private/preview/txt.php
+++ b/lib/private/preview/txt.php
@@ -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);
@@ -62,22 +61,12 @@ class TXT extends Provider {
\OC\Preview::registerProvider('OC\Preview\TXT');
-class PHP extends TXT {
-
- public function getMimeType() {
- return '/application\/x-php/';
- }
-
-}
-
-\OC\Preview::registerProvider('OC\Preview\PHP');
-
-class JavaScript extends TXT {
+class MarkDown extends TXT {
public function getMimeType() {
- return '/application\/javascript/';
+ return '/text\/(x-)?markdown/';
}
}
-\OC\Preview::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file
+\OC\Preview::registerProvider('OC\Preview\MarkDown');