Skip to content

Commit

Permalink
Merge pull request #7453 from nextcloud/txt_fopen_error
Browse files Browse the repository at this point in the history
Properly detect if fopen fails for txt previews
  • Loading branch information
rullzer authored Dec 11, 2017
2 parents 179be8d + 53400a1 commit e1740c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/private/Preview/TXT.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e1740c9

Please sign in to comment.