Merge pull request #7453 from nextcloud/txt_fopen_error

Properly detect if fopen fails for txt previews
This commit is contained in:
Roeland Jago Douma 2017-12-11 21:30:19 +01:00 committed by GitHub
commit e1740c9242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -46,6 +46,11 @@ class TXT extends Provider {
*/
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