diff --git a/lib/private/Preview/Movie.php b/lib/private/Preview/Movie.php index 82c84620dc9a..8bdc0f281a76 100644 --- a/lib/private/Preview/Movie.php +++ b/lib/private/Preview/Movie.php @@ -63,6 +63,7 @@ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { // in some cases 1MB was no enough to generate thumbnail $firstmb = stream_get_contents($handle, 5242880); file_put_contents($absPath, $firstmb); + fclose($handle); } $result = $this->generateThumbNail($maxX, $maxY, $absPath, 5); diff --git a/lib/private/Preview/SVG.php b/lib/private/Preview/SVG.php index c34f3acf7f77..aa77fb0938bf 100644 --- a/lib/private/Preview/SVG.php +++ b/lib/private/Preview/SVG.php @@ -39,10 +39,12 @@ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { $svg = new \Imagick(); $svg->setBackgroundColor(new \ImagickPixel('transparent')); - $content = stream_get_contents($fileview->fopen($path, 'r')); + $stream = $fileview->fopen($path, 'r'); + $content = stream_get_contents($stream); if (substr($content, 0, 5) !== '' . $content; } + fclose($stream); // Do not parse SVG files with references if (stripos($content, 'xlink:href') !== false) { diff --git a/lib/private/Preview/TXT.php b/lib/private/Preview/TXT.php index 74a2cdf8b30b..e984f8adf5c7 100644 --- a/lib/private/Preview/TXT.php +++ b/lib/private/Preview/TXT.php @@ -44,8 +44,9 @@ public function isAvailable(\OCP\Files\FileInfo $file) { * {@inheritDoc} */ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - $content = $fileview->fopen($path, 'r'); - $content = stream_get_contents($content,3000); + $stream = $fileview->fopen($path, 'r'); + $content = stream_get_contents($stream,3000); + fclose($stream); //don't create previews of empty text files if(trim($content) === '') {