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:
authorJulius Härtl <jus@bitgrid.net>2019-05-20 16:19:25 +0300
committerGitHub <noreply@github.com>2019-05-20 16:19:25 +0300
commitbc8eaccbcd3d4fb8b244bb4a70c8accb57b91eec (patch)
tree70cbbcef9c02de8b36d2d433d2f290c4f33c3831
parent18c5b105ea4fbf30c3a7b23b6ef0fd415440be95 (diff)
parent0326f064e831d615203afecdc13fcef1c0978453 (diff)
Fix preview generation on object storage (#506)v3.3.4
Fix preview generation on object storage
-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];