Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Preview/Office.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Preview/Office.php b/lib/Preview/Office.php
index a8cf83dd..8e8ff2ea 100644
--- a/lib/Preview/Office.php
+++ b/lib/Preview/Office.php
@@ -63,7 +63,18 @@ abstract class Office extends Provider {
* {@inheritDoc}
*/
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
- $stream = $fileview->fopen($path, 'r');
+ $fileInfo = $fileview->getFileInfo($path);
+ if (!$fileInfo || $fileInfo->getSize() === 0) {
+ return false;
+ }
+
+ $useTempFile = $fileInfo->isEncrypted() || !$fileInfo->getStorage()->isLocal();
+ if ($useTempFile) {
+ $fileName = $fileview->toTmpFile($path);
+ $stream = fopen($fileName, 'r');
+ } else {
+ $stream = $fileview->fopen($path, 'r');
+ }
$client = $this->clientService->newClient();
$options = ['timeout' => 10];