From 53400a19727f43826d016b3c360a5121a2323162 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 11 Dec 2017 20:37:18 +0100 Subject: [PATCH] Properly detect if fopen fails for txt previews Signed-off-by: Roeland Jago Douma --- lib/private/Preview/TXT.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/private/Preview/TXT.php b/lib/private/Preview/TXT.php index 6fd7a5516e0b6..a4b7ec769c04f 100644 --- a/lib/private/Preview/TXT.php +++ b/lib/private/Preview/TXT.php @@ -46,6 +46,11 @@ public function isAvailable(\OCP\Files\FileInfo $file) { */ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { $content = $fileview->fopen($path, 'r'); + + if ($content === false) { + return false; + } + $content = stream_get_contents($content,3000); //don't create previews of empty text files